DateTimeParseException: Unable to parse timestamp with timezone and microseconds in getJob test
Description
Running mvn clean install with Java 11 fails during the following test:
DaprPreviewClientGrpcTest.getJobShouldReturnResponseWithDueTimeSetWhenResponseHasDueTime
The error is due to parsing an ISO-8601 datetime string with microseconds and a timezone offset.
Steps to Reproduce
-
Set Java version:
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 java -versionOutput:
openjdk version "11.0.27" 2025-04-15 -
Run:
mvn clean install -
Observe the test failure.
Error Log
-------------------------------------------------------------------------------
Test set: io.dapr.client.DaprPreviewClientGrpcTest
-------------------------------------------------------------------------------
Tests run: 39, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.393 s
Environment
| Setting | Value |
|---|---|
| Java Version | OpenJDK 11.0.27 (Ubuntu) |
| Maven Version | mvn --version (latest) |
| Dapr SDK Version | 1.16.0-SNAPSHOT |
| OS | Ubuntu 22.04 |
| Command | mvn clean install |
Root Cause
The timestamp string:
2025-07-12T21:30:10.720884+05:30
contains both microseconds and a timezone offset, which Instant.parse() does not support.
Instant.parse() expects the datetime in UTC format like:
2025-07-12T21:30:10.720884Z
Suggested Fix
Replace:
Instant.parse(dateString);
With:
OffsetDateTime.parse(dateString, DateTimeFormatter.ISO_OFFSET_DATE_TIME).toInstant();
This change will correctly parse the datetime string with offset and microseconds.
Hello @humblefool25 , I checked this issue and the problem is you are running with java11. In order to compile it properly you need to have java17, you can find it the instructions here and here.
Even tough we are setting the compatibily mode to java11 the project need to be built with java17
We could fix it as you proposed, but not sure compiling it with java11 could have another potential issues.
I think we can close this issue @dapr/maintainers-java-sdk