Skip to content

java.lang.UnsupportedOperationException in MessagePackParser#getTokenLocation is confusing #178

Description

@making

I'm using jackson-data-bind 2.4.4 and jackson-dataformat-msgpack 0.7.0-p3

UnsupportedOperationException is thrown when no suitable constructor is found in deserializing an object.

in com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1071)

        throw JsonMappingException.from(jp, "No suitable constructor found for type "
                +_beanType+": can not instantiate from JSON object (need to add/enable type information?)");

JsonMappingException#from is called
and in com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)

    public static JsonMappingException from(JsonParser jp, String msg) {
        return new JsonMappingException(msg, ((jp == null) ? null : jp.getTokenLocation()));
    }

JsonParser#getTokenLocation is called.

in org.msgpack.jackson.dataformat.MessagePackParser.getTokenLocation(MessagePackParser.java:305)

    @Override
    public JsonLocation getTokenLocation() {
        throw new UnsupportedOperationException("Not implemented yet");
    }

Not implemented yet 😦

Since the original exception is disappeared, users could be confused what is happened.
In my case, it took time i realized the original reason was that the constructor was invalid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions