Skip to content

Wrong String.format() in StdDelegatingDeserializer hides actual error #4787

Closed
@Horus1337

Description

@Horus1337

Search before asking

  • I searched in the issues and found nothing similar.

Describe the bug

In com.fasterxml.jackson.databind.deser.std.StdDelegatingDeserializer

is the method

protected Object _handleIncompatibleUpdateValue(JsonParser p, DeserializationContext ctxt, Object intoValue)
        throws IOException
    {
        throw new UnsupportedOperationException(String.format
                ("Cannot update object of type %s (using deserializer for type %s)"
                        +intoValue.getClass().getName(), _delegateType));
    }

The String format in there is wrong, there is a '+' instead of ',' so another Runtime Exception is thrown.

protected Object _handleIncompatibleUpdateValue(JsonParser p, DeserializationContext ctxt, Object intoValue)
        throws IOException
    {
        throw new UnsupportedOperationException(String.format
                ("Cannot update object of type %s (using deserializer for type %s)",
                        intoValue.getClass().getName(), _delegateType));
    }

fixes this

Version Information

since 2.6.0

Reproduction

String.format
("Cannot update object of type %s (using deserializer for type %s)"
+"EXAMPLE", "STRING")

Expected behavior

String.format
("Cannot update object of type %s (using deserializer for type %s)",
"EXAMPLE", "STRING")

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions