Skip to content

Commit

Permalink
NIFI-13579 Corrected number case in switch statement to account for a…
Browse files Browse the repository at this point in the history
…ll type of numbers.
  • Loading branch information
dan-s1 committed Sep 6, 2024
1 parent 57c1962 commit 27f4fa5
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,13 @@ public Timestamp convertField(final Object field, final Optional<String> pattern
final Instant instant = Instant.ofEpochMilli(epochMilli);
return Timestamp.from(instant);
}
case Double number -> {
final Instant instant = FractionalSecondsUtils.toInstant(number);
return Timestamp.from(instant);
}
case Float number -> {
final Instant instant = FractionalSecondsUtils.toInstant(number.doubleValue());
return Timestamp.from(instant);
}
case Long number -> {
final Instant instant = FractionalSecondsUtils.toInstant(number);
case Number number -> {
final Instant instant;
switch (field) {
case Double d -> instant = FractionalSecondsUtils.toInstant(d);
case Float f -> instant = FractionalSecondsUtils.toInstant(f.doubleValue());
default -> instant = FractionalSecondsUtils.toInstant(number.longValue());
}
return Timestamp.from(instant);
}
case String string -> {
Expand Down

0 comments on commit 27f4fa5

Please sign in to comment.