lalicw opened a new issue #1882: NullPointerException while sqlRoute failed URL: https://github.com/apache/incubator-shardingsphere/issues/1882 ## Bug Report ShardingStatement throws NullPointerException while sqlRoute failed. in the ShardingStatement .java `private void sqlRoute(final String sql) { ShardingContext shardingContext = connection.getShardingContext(); routeResult = new StatementRoutingEngine(shardingContext.getShardingRule(), shardingContext.getMetaData(), shardingContext.getDatabaseType(), shardingContext.getShardingProperties().<Boolean>getValue(ShardingPropertiesConstant.SQL_SHOW)).route(sql); }` while route(sql) failed, the routeResult will be null and throws the original exception. but in the execute method: `public boolean execute(final String sql) throws SQLException { try { clearPrevious(); sqlRoute(sql); initStatementExecutor(); return statementExecutor.execute(); } finally { refreshTableMetaData(connection.getShardingContext(), routeResult.getSqlStatement()); currentResultSet = null; } }` this code will invoke routeResult.getSqlStatement() and throws NullPointerException and lost the original Exception Please answer these questions before submitting your issue. Thanks! ### Which version of ShardingSphere did you use? 3.1 ### Which project did you use? Sharding-JDBC or Sharding-Proxy? Sharding-JDBC ### Expected behavior throw the original exception ### Actual behavior lost the original exception and throws NullPointerException ### Reason analyze (If you can) as above ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. as mentioned ### Example codes for reproduce this issue (such as a github link). as mentioned
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
