Skip to content

FilteringParserDelegate can go into an infinite loop if underlying parser is non-blocking #1144

@simonbasle

Description

@simonbasle

Jackson version (BOM): 2.15.2

While experimenting with JsonPointer in Spring Framework, I tried to build up on the existing FilteringParserDelegate and associated JsonPointerBasedTokenFilter. Unfortunately, this doesn't seem to work with a non-blocking JsonParser delegate, for several reasons:

  • it doesn't delegate method canParseAsync() (ends up returning the default interface implem => false)
  • it doesn't delegate method getNonBlockingInputFeeder() (same as above => null)
  • it isn't aware of JsonToken.NOT_AVAILABLE

While the first two are easily circumvented by extending FilteringParserDelegate, the last one is the truly problematic one. It results in going down the code path of a "scalar value", and will continuously call delegate.nextToken() which continues to result in NOT_AVAILABLE.

This leads to an infinite loop when attempting to filter based on a JsonPointer on top of a non-blocking parser.

Is there anything fundamentally preventing FilteringParserDelegate from being compatible with non-blocking parsers that I might have overlooked? Otherwise I think it's pretty close, hopefully that can be fixed 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.19Issues planned at earliest for 2.19has-failing-testIndicates that there exists a test case (under `failing/`) to reproduce the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions