Fix null pointer issue in SqlDatabaseContentRetriever when column value is null (#1161)

This pull request addresses the null pointer exception issue in the
`SqlDatabaseContentRetriever` class that occurs when a certain column
value from a database query is null. The code now includes a check for
null values before attempting to access them.
This commit is contained in:
hongliangzhang07 2024-05-27 23:10:45 +08:00 committed by GitHub
parent 9d229e9756
commit 8eccd34c68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -330,7 +330,9 @@ public class SqlDatabaseContentRetriever implements ContentRetriever {
while (resultSet.next()) {
List<String> columnValues = new ArrayList<>();
for (int i = 1; i <= columnCount; i++) {
String columnValue = resultSet.getObject(i).toString();
String columnValue = resultSet.getObject(i)==null?"":resultSet.getObject(i).toString();
if (columnValue.contains(",")) {
columnValue = "\"" + columnValue + "\"";
}