Skip to content

ClassCastException when deleting missing path in specific circumstances #870

Open
@binokkio

Description

@binokkio

Summary
When deleting a missing path from a DocumentContext coming from a Configuration with the Option.SUPPRESS_EXCEPTIONS and the GsonJsonProvider, JacksonJsonNodeJsonProvider, JettisonProvider, JsonOrgJsonProvider or TapestryJsonProvider, a ClassCastException is thrown. The other modification methods, set, add, renameKey and put, might be affected too.

Steps to reproduce

Configuration configuration = Configuration.builder()
        .jsonProvider(new JacksonJsonNodeJsonProvider())
        .options(Option.SUPPRESS_EXCEPTIONS)
        .build();

DocumentContext documentContext = JsonPath.parse("{}", configuration);

documentContext.delete("$..this..path..is..missing");  // this throws a ClassCastException

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