Skip to content

[Bug]: Select values (and JSON input) - unable to convert string timestamps #4907

@dave-csc

Description

@dave-csc

Apache Hop version?

2.11.0

Java version?

17.0.2

Operating system

Linux

What happened?

Set up a Select values transform in order to convert a String in the form 2025-02-13T02:10:14.746582 in a Timestamp or Date object with format yyyy-MM-dd'T'HH:mm:ss.SSSXXX.

When trying to convert it to a Timestamp, the error reported is:

2025/02/14 11:04:53 - Formato output.0 - ERROR: Unexpected error
2025/02/14 11:04:53 - Formato output.0 - ERROR: java.lang.NullPointerException: Cannot invoke "java.util.Date.getTime()" because "tempDate" is null
2025/02/14 11:04:53 - Formato output.0 - 	at org.apache.hop.core.row.value.timestamp.SimpleTimestampFormat.parse(SimpleTimestampFormat.java:341)
2025/02/14 11:04:53 - Formato output.0 - 	at java.base/java.text.DateFormat.parse(DateFormat.java:397)
2025/02/14 11:04:53 - Formato output.0 - 	at org.apache.hop.core.row.value.timestamp.SimpleTimestampFormat.parse(SimpleTimestampFormat.java:448)
2025/02/14 11:04:53 - Formato output.0 - 	at org.apache.hop.core.row.value.ValueMetaTimestamp.convertStringToTimestamp(ValueMetaTimestamp.java:262)
2025/02/14 11:04:53 - Formato output.0 - 	at org.apache.hop.core.row.value.ValueMetaTimestamp.convertData(ValueMetaTimestamp.java:424)
2025/02/14 11:04:53 - Formato output.0 - 	at org.apache.hop.pipeline.transforms.selectvalues.SelectValues.metadataValues(SelectValues.java:347)
2025/02/14 11:04:53 - Formato output.0 - 	at org.apache.hop.pipeline.transforms.selectvalues.SelectValues.processRow(SelectValues.java:402)
2025/02/14 11:04:53 - Formato output.0 - 	at org.apache.hop.pipeline.transform.RunThread.run(RunThread.java:54)
2025/02/14 11:04:53 - Formato output.0 - 	at java.base/java.lang.Thread.run(Thread.java:833)

When trying to convert it into a Date, this is the error reported:

2025/02/14 11:08:39 - Formato output.0 - ERROR: Unexpected error
2025/02/14 11:08:39 - Formato output.0 - ERROR: org.apache.hop.core.exception.HopConversionException: 
2025/02/14 11:08:39 - Formato output.0 - 
2025/02/14 11:08:39 - Formato output.0 - create_date String : couldn't convert string [2025-02-13T02:10:14.746582] to a date using format [yyyy-MM-dd'T'HH:mm:ss.SSSXXX] on offset location 26
2025/02/14 11:08:39 - Formato output.0 - 2025-02-13T02:10:14.746582
2025/02/14 11:08:39 - Formato output.0 - 
2025/02/14 11:08:39 - Formato output.0 - 
2025/02/14 11:08:39 - Formato output.0 - 	at org.apache.hop.pipeline.transforms.selectvalues.SelectValues.metadataValues(SelectValues.java:353)
2025/02/14 11:08:39 - Formato output.0 - 	at org.apache.hop.pipeline.transforms.selectvalues.SelectValues.processRow(SelectValues.java:402)
2025/02/14 11:08:39 - Formato output.0 - 	at org.apache.hop.pipeline.transform.RunThread.run(RunThread.java:54)
2025/02/14 11:08:39 - Formato output.0 - 	at java.base/java.lang.Thread.run(Thread.java:833)

Similar issues happen with the JSON Input transform, when trying to read those string timestamps directly as Timestamp or Date.

Issue Priority

Priority: 2

Issue Component

Component: Transforms

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions