NIFI-7095: ResetSetRecordSet: handle java.sql.Array Types in normalizeValue method

Some jdbc drivers e.g. Oracle returns java.sql.Array objects for array types, not just Lists.
This commit also handles these cases, and extracts the primitive java arrays out of this jdbc holder class.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #4034.
This commit is contained in:
Christian Zügner 2020-02-04 10:34:07 +01:00 committed by Pierre Villard
parent dd6bcc7485
commit 98f9b7c033
No known key found for this signature in database
GPG Key ID: BEE1599F0726E9CD
1 changed files with 5 additions and 1 deletions

View File

@ -128,7 +128,7 @@ public class ResultSetRecordSet implements RecordSet, Closeable {
}
@SuppressWarnings("rawtypes")
private Object normalizeValue(final Object value) {
private Object normalizeValue(final Object value) throws SQLException {
if (value == null) {
return null;
}
@ -137,6 +137,10 @@ public class ResultSetRecordSet implements RecordSet, Closeable {
return ((List) value).toArray();
}
if (value instanceof Array) {
return ((Array) value).getArray();
}
return value;
}