ZonedDateTime not supported

Issue #372 new
Jérôme LELEU created an issue

Hi,

I use the nimbus-jose-jwt library v8.19.

It seems I can’t use ZonedDateTime objects for the claims of a JWT. Example:

import com.nimbusds.jwt.JWT;
import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.PlainJWT;

import java.time.ZonedDateTime;

public class Test {

    public static void main(String... args) {
        final JWTClaimsSet.Builder builder = new JWTClaimsSet.Builder();
        builder.claim("key", ZonedDateTime.now());
        JWTClaimsSet claims = builder.build();
        JWT jwt = new PlainJWT(claims);
        System.out.println(jwt.serialize());
    }
}

It throws the following exception:

Exception in thread "main" java.lang.IllegalAccessError: class net.minidev.asm.java.time.ZonedDateTimeAccAccess tried to access private field java.time.ZonedDateTime.offset (net.minidev.asm.java.time.ZonedDateTimeAccAccess is in unnamed module of loader net.minidev.asm.DynamicClassLoader @9660f4e; java.time.ZonedDateTime is in module java.base of loader 'bootstrap')
at net.minidev.asm.java.time.ZonedDateTimeAccAccess.get(Unknown Source)
at net.minidev.json.reader.BeansWriterASM.writeJSONString(BeansWriterASM.java:21)
at net.minidev.json.JSONValue.writeJSONString(JSONValue.java:586)

Am I missing something?

Thanks.

Best regards,

Jérôme

Comments (7)

  1. Vladimir Dzhuvinov

    Hi!

    No concrete plans for Java 8 yet, we have just this and several other tickets to take advantage of new classes and features in Java 8.

    Do you reckon you can work around this?

    The next major release (complete, waiting to be merged) will be removing the JSON smart dependency, by shading it.

  2. Jérôme LELEU reporter

    Sure. We can deal with that, turning ZoneDameTime into the old Date object for example.

  3. Log in to comment