[
https://issues.apache.org/jira/browse/NIFI-5584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16962482#comment-16962482
]
M Tien commented on NIFI-5584:
------------------------------
This ticket is OBE. The change was made in PR 3584 for NIFI-6442. Closing
ticket.
> 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
>
> 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)