This is an automated email from the ASF dual-hosted git repository.

sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 5ff1c1558f9 Use ShardingSpherePreconditions.checkNotNull instead of 
ShardingSpherePreconditions.checkState(null != xxx) (#30923)
5ff1c1558f9 is described below

commit 5ff1c1558f9b33b68f054de5e0c7d807ef6bb390
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Apr 17 00:26:24 2024 +0800

    Use ShardingSpherePreconditions.checkNotNull instead of 
ShardingSpherePreconditions.checkState(null != xxx) (#30923)
---
 .../execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java | 2 +-
 .../driver/jdbc/core/resultset/ShardingSphereResultSet.java             | 2 +-
 .../apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java | 2 +-
 .../command/query/extended/describe/PostgreSQLComDescribeExecutor.java  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
 
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
index b86159898ad..239486e2672 100644
--- 
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
+++ 
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
@@ -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);
         }
diff --git 
a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSet.java
 
b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSet.java
index 0197963b978..6280811ce1e 100644
--- 
a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSet.java
+++ 
b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSet.java
@@ -394,7 +394,7 @@ public final class ShardingSphereResultSet extends 
AbstractResultSetAdapter {
     
     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;
     }
 }
diff --git 
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java
 
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java
index 269699f3941..c82b5c31098 100644
--- 
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java
+++ 
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java
@@ -225,7 +225,7 @@ public final class SQLFederationEngine implements 
AutoCloseable {
                         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);
         }
diff --git 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
index 4acb8c788c9..eb06c606f57 100644
--- 
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
+++ 
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutor.java
@@ -148,7 +148,7 @@ public final class PostgreSQLComDescribeExecutor implements 
CommandExecutor {
                 }
                 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()));
             }
         }

Reply via email to