Details
-
Improvement
-
Status: Resolved
-
Trivial
-
Resolution: Fixed
-
1.7.1
-
None
-
RHEL, JDK 8
Description
The method DataTypeUtils.toTimestamp in package nifi-record has the if statement structured as follows:
public static Timestamp toTimestamp(final Object value, final Supplier<DateFormat> format, final String fieldName) { if (value == null) { return null; } if (value instanceof java.util.Date) { return new Timestamp(((java.util.Date)value).getTime()); } if (value instanceof Timestamp) { return (Timestamp) value; }
Since Timestamp extends java.util.Date a value of type timestamp always matches the 1st if statement and allocates a new timestamp object. The 1st if statement should check for timestamp followed by java.util.Date check.
Attachments
Issue Links
- is related to
-
NIFI-6442 ExecuteSQL/ExecuteSQLRecord convert to Avro date type incorrectly when set 'Use Avro Logical Types' to true
- Resolved