Fixed: Possible NPE in DatabaseUtil.getColumnInfo(...)
@@ -857,22 +857,21 @@ public class DatabaseUtil {
// get ALL tables from this database
TreeSet<String> tableNames = this.getTableNames(messages);
+ List<ModelEntity> newEntList = new LinkedList<>();
+ if (UtilValidate.isNotEmpty(tableNames)) {
// get ALL column info, put into hashmap by table name
Map<String, Map<String, ColumnCheckInfo>> colInfo = getColumnInfo(tableNames, true, messages, executor);
-
// go through each table and make a ModelEntity object, add to list
// for each entity make corresponding ModelField objects
// then print out XML for the entities/fields
- List<ModelEntity> newEntList = new LinkedList<>();
-
boolean isCaseSensitive = getIsCaseSensitive(messages);
-
// iterate over the table names is alphabetical order
for (String tableName : new TreeSet<>(colInfo.keySet())) {
Map<String, ColumnCheckInfo> colMap = colInfo.get(tableName);
ModelEntity newEntity = new ModelEntity(tableName, colMap, modelFieldTypeReader, isCaseSensitive);
newEntList.add(newEntity);
}
+ }
executor.shutdown();
return newEntList;
@@ -1109,7 +1108,7 @@ public class DatabaseUtil {
private Map<String, Map<String, ColumnCheckInfo>> getColumnInfo(Set<String> tableNames, boolean getPks, Collection<String> messages,
ExecutorService executor) {
// if there are no tableNames, don't even try to get the columns
- if (tableNames.isEmpty()) {
+ if (UtilValidate.isEmpty(tableNames)) {
return new HashMap<>();
}
