Skip to content

Commit

Permalink
Allow multiple matches with JsonPointerBasedFilter
Browse files Browse the repository at this point in the history
JsonParser has not been working well with JSON Pointer for consequent multiple JSONs
when used with Jackson 2.7.4+.

For example of multiple JSONs in one stream: {"a": {"b": 1}} {"a": {"b": 2}}

It happened because Jackson 2.7.3 or earlier ignored the `allowMultipleMatches` option.
FasterXML/jackson-core#209

This commit fixes this problem by setting the option when used with Jackson 2.7.4+.
  • Loading branch information
dmikurube committed Jul 3, 2023
1 parent 3428732 commit fc4971f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/org/embulk/util/json/JsonParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ private static String sampleJsonString(final String json) {

private static com.fasterxml.jackson.core.JsonParser wrapWithPointerFilter(
final com.fasterxml.jackson.core.JsonParser baseParser, final String offsetInJsonPointer) {
return new FilteringParserDelegate(baseParser, new JsonPointerBasedFilter(offsetInJsonPointer), false, false);
return new FilteringParserDelegate(
baseParser,
new JsonPointerBasedFilter(offsetInJsonPointer),
false,
true // Allow multiple matches
);
}

private static class StreamParseContext extends AbstractParseContext implements Stream {
Expand Down

0 comments on commit fc4971f

Please sign in to comment.