Skip to content

Commit

Permalink
Try to make Sonar happier
Browse files Browse the repository at this point in the history
  • Loading branch information
radovanradic committed Dec 10, 2024
1 parent 49c17a9 commit af66832
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,22 @@ public Object readDynamic(ResultSet resultSet, String index, DataType dataType)
}

private boolean containsColumnName(ResultSet resultSet, String name) {
if (name == null) {
return false;
}
if (knownColumns == null) {
try {
ResultSetMetaData rsmd = resultSet.getMetaData();
int columnsCount = rsmd.getColumnCount();
knownColumns = CollectionUtils.newHashSet(columnsCount);
for (int x = 1; x <= columnsCount; x++) {
knownColumns.add(rsmd.getColumnLabel(x).toLowerCase());
knownColumns.add(toLowerCase(rsmd.getColumnLabel(x)));
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
return knownColumns.contains(name.toLowerCase());
return knownColumns.contains(toLowerCase(name));
}

private static String toLowerCase(String str) {
return str == null ? null : str.toLowerCase();
}
}

0 comments on commit af66832

Please sign in to comment.