crossbario / autobahn-java

WebSocket & WAMP in Java for Android and Java 8
https://crossbar.io/autobahn
MIT License
1.52k stars 427 forks source link

Datatype module support to make Jackson recognize Java 8 Date & Time #551

Closed pavelvic closed 8 months ago

pavelvic commented 9 months ago

Hi! There is no feature for parsing Java 8 Date & Time formats.

IIf we try to deserialize string obj "2023-10-06T18:29:50.138+03:00" to object of class OffsetDateTime, we have the exception "com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type java.time.OffsetDateTime not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling".

So this PR add this feature to your wonderful library

oberstet commented 9 months ago

great, thanks for contributing! this change looks straight forward and good - however, the CI fails for some tools/SDK issues .. not sure what's the matter ..

om26er commented 9 months ago

I think we should try a restart of the CI first.

pavelvic commented 9 months ago

Following this

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

It looks like your CI-pipeline uses Java 11 (major Java version = 55) for compiling class com/android/prefs/AndroidLocationsProvider, and then CI-pipeline try to run compiled code using Java 8 (major Java version = 52). Can you try to fix your CI? Unfortunately, I can't do this because I don't have necessary skills :(

Maybe it helps - https://www.baeldung.com/java-lang-unsupportedclassversion

pavelvic commented 9 months ago

Here is issue from android-actions repo. There is no problem solving. But people say, that it happens sporadically. So maybe restart of the CI can help. If you can, try to restart please https://github.com/android-actions/setup-android/issues/378

oberstet commented 9 months ago

fwiw, I've restarted this PR's CI jobs, lets see. I think this needs update to grab "the new" java thing for running this CI https://github.com/crossbario/autobahn-java/blob/master/.github/workflows/main.yml

pavelvic commented 9 months ago

Hi! I fix the pipeline in my fork! The problem was in Java version. This action 'android-actions/setup-android@v2' installs Android SDK. And it requires Java 11 at the environment. Unfortunately, I can't find why it requires Java 11. May be there are some changes in 'android-actions/setup-android@v2' or in the Android SDK. I have changed the java version in pipeline from 8 to 11 and it works. There is a result of running this pipeline in my fork - succeeded: https://github.com/pavelvic/autobahn-java/actions/runs/6564538141/job/17831094583 So, if you merge this PR, the pipeline must work :)

pavelvic commented 8 months ago

So, do you still need this feature? Or should I close this PR?

oberstet commented 8 months ago

@pavelvic sorry for the delay, merged. thanks for contributing!