sunbufu commented on issue #2664: ResultSetReturnedDatabaseMetaData.getActualTableNamePattern() has a NullPointerException URL: https://github.com/apache/incubator-shardingsphere/issues/2664#issuecomment-508886781 I have reproduced this issue. Only `4.0.0-RC1` and before version may have this issue. In `4.0.0-RC1` version. This place will throw a NPE when `tableNamePattern` is `%` and `shardingRule` is `null`. ```java private String getActualTableNamePattern(final String tableNamePattern) { return null == tableNamePattern ? tableNamePattern : (shardingRule.findTableRule(tableNamePattern).isPresent() ? "%" + tableNamePattern + "%" : tableNamePattern); } ``` But in `4.0.0-RC2-SNAPSHOT` version. This method will run without NPE. ```java private String getActualTableNamePattern(final String tableNamePattern) { if (null == tableNamePattern || null == shardingRule) { return tableNamePattern; } return shardingRule.findTableRule(tableNamePattern).isPresent() ? "%" + tableNamePattern + "%" : tableNamePattern; } ``` The reason may be this. If we set `ddl-auto` is `update`, `create` and so on. Hibernate may execute DDL when application is on starting, and shardingsphere has not been initialized yet, `shardingRule` is null too.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to 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
