[ 
https://issues.apache.org/jira/browse/NIFI-5584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

M Tien resolved NIFI-5584.
--------------------------
    Fix Version/s: 1.10.0
       Resolution: Fixed

Fixed by code which will be in 1.10.0

> Reorder if statement in DataTypeUtils.toTimestamp so that Timestamp comes 
> before Date
> -------------------------------------------------------------------------------------
>
>                 Key: NIFI-5584
>                 URL: https://issues.apache.org/jira/browse/NIFI-5584
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>    Affects Versions: 1.7.1
>         Environment: RHEL, JDK 8
>            Reporter: Gideon Korir
>            Assignee: M Tien
>            Priority: Trivial
>             Fix For: 1.10.0
>
>
> The method DataTypeUtils.toTimestamp in package nifi-record has the if 
> statement structured as follows:
> {code:java}
> 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;
> }
> {code}
> 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.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to