Skip to content

Commit

Permalink
Use ShardingSpherePreconditions.checkNotNull instead of ShardingSpher…
Browse files Browse the repository at this point in the history
…ePreconditions.checkState(null != xxx) (#30923)
  • Loading branch information
terrymanu authored Apr 16, 2024
1 parent 60aaf2f commit 5ff1c15
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public final class ResultSetUtils {
* @throws SQLFeatureNotSupportedException SQL feature not supported exception
*/
public static Object convertValue(final Object value, final Class<?> convertType) throws SQLFeatureNotSupportedException {
ShardingSpherePreconditions.checkState(null != convertType, () -> new SQLFeatureNotSupportedException("Type can not be null"));
ShardingSpherePreconditions.checkNotNull(convertType, () -> new SQLFeatureNotSupportedException("Type can not be null"));
if (null == value) {
return convertNullValue(convertType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public <T> T getObject(final String columnLabel, final Class<T> type) throws SQL

private Integer getIndexFromColumnLabelAndIndexMap(final String columnLabel) throws SQLException {
Integer result = columnLabelAndIndexMap.get(columnLabel);
ShardingSpherePreconditions.checkState(null != result, () -> new SQLFeatureNotSupportedException(String.format("Can not get index from column label `%s`.", columnLabel)));
ShardingSpherePreconditions.checkNotNull(result, () -> new SQLFeatureNotSupportedException(String.format("Can not get index from column label `%s`.", columnLabel)));
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private ExecutionPlanCacheKey buildCacheKey(final SQLFederationContext federatio
sqlStatementCompiler);
for (String each : selectStatementContext.getTablesContext().getTableNames()) {
ShardingSphereTable table = schema.getTable(each);
ShardingSpherePreconditions.checkState(null != table, () -> new NoSuchTableException(each));
ShardingSpherePreconditions.checkNotNull(table, () -> new NoSuchTableException(each));
// TODO replace DEFAULT_METADATA_VERSION with actual version in ShardingSphereTable
result.getTableMetaDataVersions().put(table.getName(), DEFAULT_METADATA_VERSION);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private void describeInsertStatementByDatabaseMetaData(final PostgreSQLServerPre
}
String columnName = columnNamesOfInsert.get(columnIndex);
ShardingSphereColumn column = table.getColumn(columnName);
ShardingSpherePreconditions.checkState(null != column, () -> new ColumnNotFoundException(logicTableName, columnName));
ShardingSpherePreconditions.checkNotNull(column, () -> new ColumnNotFoundException(logicTableName, columnName));
preparedStatement.getParameterTypes().set(parameterMarkerIndex++, PostgreSQLColumnType.valueOfJDBCType(column.getDataType()));
}
}
Expand Down

0 comments on commit 5ff1c15

Please sign in to comment.