markap14 commented on a change in pull request #3724: NIFI-6640 - UNION/CHOICE
types not handled correctly
URL: https://github.com/apache/nifi/pull/3724#discussion_r324306453
##########
File path:
nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/util/DataTypeUtils.java
##########
@@ -440,12 +539,12 @@ public static DataType inferDataType(final Object value,
final DataType defaultT
// final DataType elementDataType = inferDataType(valueFromMap,
RecordFieldType.STRING.getDataType());
// return RecordFieldType.MAP.getMapDataType(elementDataType);
}
- if (value instanceof Object[]) {
- final Object[] array = (Object[]) value;
-
+ if (value.getClass().isArray()) {
Review comment:
Neat! I don't think I realized that `Class.isArray()` and
`Array.getLength()` / `Array.get()` were a thing.
----------------------------------------------------------------
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