Browse Source

Remove jackson override and upgrade to jackson to 2.14.2 (#93342)

before the jackson 2.14.2 elasticserach had to override the jackson locally to avoid a bug when filtering empty arrays. #92984
This commit reverts the local override and upgrades jackson to 2.14.2 which contain the fix to the bug
Przemyslaw Gomulka 2 years ago
parent
commit
d065d4b76d

+ 123 - 146
gradle/verification-metadata.xml

@@ -274,9 +274,9 @@
             <sha256 value="4c2e043200edd9ee7ba6fc378bd5c17784a5bf2388e152d208068b51fd0839cf" origin="Generated by Gradle"/>
          </artifact>
       </component>
-      <component group="com.fasterxml.jackson.core" name="jackson-core" version="2.14.1">
-         <artifact name="jackson-core-2.14.1.jar">
-            <sha256 value="0114187e296b34c931c1bf9e5a84152b62bfab7d182f5623f3982dc2da35e526" origin="Generated by Gradle"/>
+      <component group="com.fasterxml.jackson.core" name="jackson-core" version="2.14.2">
+         <artifact name="jackson-core-2.14.2.jar">
+            <sha256 value="b5d37a77c88277b97e3593c8740925216c06df8e4172bbde058528df04ad3e7a" origin="Generated by Gradle"/>
          </artifact>
       </component>
       <component group="com.fasterxml.jackson.core" name="jackson-databind" version="2.10.5.1">
@@ -319,9 +319,9 @@
             <sha256 value="8a6a687759739421b1f3c3f9678e7bc1cb37df5832e365996e2f412d7ca7e860" origin="Generated by Gradle"/>
          </artifact>
       </component>
-      <component group="com.fasterxml.jackson.dataformat" name="jackson-dataformat-cbor" version="2.14.1">
-         <artifact name="jackson-dataformat-cbor-2.14.1.jar">
-            <sha256 value="aa491e4850fbf278d321d42e924e0471aa51666584baf200d1851bb1ce4562c1" origin="Generated by Gradle"/>
+      <component group="com.fasterxml.jackson.dataformat" name="jackson-dataformat-cbor" version="2.14.2">
+         <artifact name="jackson-dataformat-cbor-2.14.2.jar">
+            <sha256 value="c942726863a8b7e0483d30d9213f9dadc8b07eadf0767003a4fe6dc56daa7135" origin="Generated by Gradle"/>
          </artifact>
       </component>
       <component group="com.fasterxml.jackson.dataformat" name="jackson-dataformat-smile" version="2.13.2">
@@ -329,9 +329,9 @@
             <sha256 value="cc492aaeeb5cdb899d175c8433846eeddf2a52e92aee79e94ce6a34f86f38f98" origin="Generated by Gradle"/>
          </artifact>
       </component>
-      <component group="com.fasterxml.jackson.dataformat" name="jackson-dataformat-smile" version="2.14.1">
-         <artifact name="jackson-dataformat-smile-2.14.1.jar">
-            <sha256 value="63dacc4cc9288b89ef9d3e664fed687ba296c9f808e674e95884aea387a9e552" origin="Generated by Gradle"/>
+      <component group="com.fasterxml.jackson.dataformat" name="jackson-dataformat-smile" version="2.14.2">
+         <artifact name="jackson-dataformat-smile-2.14.2.jar">
+            <sha256 value="9c279bb29770de09289c14cf8862dd195112687cd7fde815919f54a9157ce213" origin="Generated by Gradle"/>
          </artifact>
       </component>
       <component group="com.fasterxml.jackson.dataformat" name="jackson-dataformat-xml" version="2.13.2">
@@ -349,9 +349,9 @@
             <sha256 value="e0a4d674e5aaf30ed3cd045e7fd94e9b82f0a7fbe94b25c8c496f70977966ba3" origin="Generated by Gradle"/>
          </artifact>
       </component>
-      <component group="com.fasterxml.jackson.dataformat" name="jackson-dataformat-yaml" version="2.14.1">
-         <artifact name="jackson-dataformat-yaml-2.14.1.jar">
-            <sha256 value="9e157e2625ed855ab73af7915e256f6823993a30982f4923c9ca82bb752a0303" origin="Generated by Gradle"/>
+      <component group="com.fasterxml.jackson.dataformat" name="jackson-dataformat-yaml" version="2.14.2">
+         <artifact name="jackson-dataformat-yaml-2.14.2.jar">
+            <sha256 value="5c3a0a71d0339529c80ae771497b20fdc0fa7cb67c772f99af5935927560006a" origin="Generated by Gradle"/>
          </artifact>
       </component>
       <component group="com.fasterxml.jackson.datatype" name="jackson-datatype-jsr310" version="2.13.2">
@@ -759,36 +759,31 @@
             <sha256 value="37f5216e14af2772930dff9b8734353f0a80e89ba3f33e065441de6537c5e842" origin="Generated by Gradle"/>
          </artifact>
       </component>
-       <component group="com.ibm.icu" name="icu4j" version="61.1">
-           <artifact name="icu4j-61.1.jar">
-               <sha256 value="55c98eb1838b2a4bb9a07dc36bd378532d64d0cdcb7ceee914236866a7de4464"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="com.ibm.icu" name="icu4j" version="68.2">
-           <artifact name="icu4j-68.2.jar">
-               <sha256 value="9bd7bf869a44ba8aeb0cddd7e6616e88cd4795ba5bfce2230447cb0e185a646c"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="com.ibm.icu" name="icu4j" version="71.1">
-           <artifact name="icu4j-71.1.jar">
-               <sha256 value="91c4f8ebf0ceb489547098fe9d5c09a65eb419caea6ed714867f5280800bcf1a"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="com.jamesmurty.utils" name="java-xmlbuilder" version="0.4">
-           <artifact name="java-xmlbuilder-0.4.jar">
-               <sha256 value="681e53c4ffd59fa12068803b259e3a83d43f07a47c112e748a187dee179eb31f"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="com.jcraft" name="jsch" version="0.1.54">
-           <artifact name="jsch-0.1.54.jar">
-               <sha256 value="92eb273a3316762478fdd4fe03a0ce1842c56f496c9c12fe1235db80450e1fdb"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
+      <component group="com.ibm.icu" name="icu4j" version="61.1">
+         <artifact name="icu4j-61.1.jar">
+            <sha256 value="55c98eb1838b2a4bb9a07dc36bd378532d64d0cdcb7ceee914236866a7de4464" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="com.ibm.icu" name="icu4j" version="68.2">
+         <artifact name="icu4j-68.2.jar">
+            <sha256 value="9bd7bf869a44ba8aeb0cddd7e6616e88cd4795ba5bfce2230447cb0e185a646c" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="com.ibm.icu" name="icu4j" version="71.1">
+         <artifact name="icu4j-71.1.jar">
+            <sha256 value="91c4f8ebf0ceb489547098fe9d5c09a65eb419caea6ed714867f5280800bcf1a" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="com.jamesmurty.utils" name="java-xmlbuilder" version="0.4">
+         <artifact name="java-xmlbuilder-0.4.jar">
+            <sha256 value="681e53c4ffd59fa12068803b259e3a83d43f07a47c112e748a187dee179eb31f" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="com.jcraft" name="jsch" version="0.1.54">
+         <artifact name="jsch-0.1.54.jar">
+            <sha256 value="92eb273a3316762478fdd4fe03a0ce1842c56f496c9c12fe1235db80450e1fdb" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
       <component group="com.jcraft" name="jsch" version="0.1.55">
          <artifact name="jsch-0.1.55.jar">
             <sha256 value="d492b15a6d2ea3f1cc39c422c953c40c12289073dbe8360d98c0f6f9ec74fc44" origin="Generated by Gradle"/>
@@ -1688,82 +1683,69 @@
             <sha256 value="adb1a33c07b45c39b926bdeeadf800f701be9c3d04e0deb543069e5f09856185" origin="Generated by Gradle"/>
          </artifact>
       </component>
-       <component group="org.abego.treelayout" name="org.abego.treelayout.core" version="1.0.3">
-           <artifact name="org.abego.treelayout.core-1.0.3.jar">
-               <sha256 value="fa5e31395c39c2e7d46aca0f81f72060931607b2fa41bd36038eb2cb6fb93326"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="ST4" version="4.3">
-           <artifact name="ST4-4.3.jar">
-               <sha256 value="28547dba48cfceb77b6efbfe069aebe9ed3324ae60dbd52093d13a1d636ed069"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="ST4" version="4.3.4">
-           <artifact name="ST4-4.3.4.jar">
-               <sha256 value="f927ac384c46d749f8b5ec68972a53aed21e00313509299616edb73bfa15ff33"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="antlr-runtime" version="3.4">
-           <artifact name="antlr-runtime-3.4.jar">
-               <sha256 value="5b7cf53b7b30b034023f58030c8147c433f2bee0fe7dec8fae6bebf3708c5a63"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="antlr-runtime" version="3.5.2">
-           <artifact name="antlr-runtime-3.5.2.jar">
-               <sha256 value="ce3fc8ecb10f39e9a3cddcbb2ce350d272d9cd3d0b1e18e6fe73c3b9389c8734"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="antlr-runtime" version="3.5.3">
-           <artifact name="antlr-runtime-3.5.3.jar">
-               <sha256 value="68bf9f5a33dfcb34033495c587e6236bef4e37aa6612919f5b1e843b90669fb9"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="antlr4" version="4.11.1">
-           <artifact name="antlr4-4.11.1.jar">
-               <sha256 value="e9686e8a663ca512afe3a2eeb6f6ad3f303abb46188991f19ebc6a0fd9c1c14f"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="antlr4" version="4.5.3">
-           <artifact name="antlr4-4.5.3.jar">
-               <sha256 value="a32de739cfdf515774e696f91aa9697d2e7731e5cb5045ca8a4b657f8b1b4fb4"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="antlr4" version="4.9.2">
-           <artifact name="antlr4-4.9.2.jar">
-               <sha256 value="7d66253762da7c8c7ab6ac05da1471aeeb3cb8e92310ecfb08f939306b4c7dae"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="antlr4-runtime" version="4.10.1">
-           <artifact name="antlr4-runtime-4.10.1.jar">
-               <sha256 value="da66be0c98acfb29bc708300d05f1a3269c40f9984a4cb9251cf2ba1898d1334"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="antlr4-runtime" version="4.11.1">
-           <artifact name="antlr4-runtime-4.11.1.jar">
-               <sha256 value="e06c6553c1ccc14d36052ec4b0fc6f13b808cf957b5b1dc3f61bf401996ada59"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="antlr4-runtime" version="4.5.1-1">
-           <artifact name="antlr4-runtime-4.5.1-1.jar">
-               <sha256 value="ffca72bc2a25bb2b0c80a58cee60530a78be17da739bb6c91a8c2e3584ca099e"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.antlr" name="antlr4-runtime" version="4.5.3">
-           <artifact name="antlr4-runtime-4.5.3.jar">
-               <sha256 value="93bca08ec995caeaaf60bdf80035a0be8507fcdabd3c2618fd8c5aab4444a752"
-                       origin="Generated by Gradle"/>
+      <component group="org.abego.treelayout" name="org.abego.treelayout.core" version="1.0.3">
+         <artifact name="org.abego.treelayout.core-1.0.3.jar">
+            <sha256 value="fa5e31395c39c2e7d46aca0f81f72060931607b2fa41bd36038eb2cb6fb93326" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="ST4" version="4.3">
+         <artifact name="ST4-4.3.jar">
+            <sha256 value="28547dba48cfceb77b6efbfe069aebe9ed3324ae60dbd52093d13a1d636ed069" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="ST4" version="4.3.4">
+         <artifact name="ST4-4.3.4.jar">
+            <sha256 value="f927ac384c46d749f8b5ec68972a53aed21e00313509299616edb73bfa15ff33" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="antlr-runtime" version="3.4">
+         <artifact name="antlr-runtime-3.4.jar">
+            <sha256 value="5b7cf53b7b30b034023f58030c8147c433f2bee0fe7dec8fae6bebf3708c5a63" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="antlr-runtime" version="3.5.2">
+         <artifact name="antlr-runtime-3.5.2.jar">
+            <sha256 value="ce3fc8ecb10f39e9a3cddcbb2ce350d272d9cd3d0b1e18e6fe73c3b9389c8734" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="antlr-runtime" version="3.5.3">
+         <artifact name="antlr-runtime-3.5.3.jar">
+            <sha256 value="68bf9f5a33dfcb34033495c587e6236bef4e37aa6612919f5b1e843b90669fb9" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="antlr4" version="4.11.1">
+         <artifact name="antlr4-4.11.1.jar">
+            <sha256 value="e9686e8a663ca512afe3a2eeb6f6ad3f303abb46188991f19ebc6a0fd9c1c14f" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="antlr4" version="4.5.3">
+         <artifact name="antlr4-4.5.3.jar">
+            <sha256 value="a32de739cfdf515774e696f91aa9697d2e7731e5cb5045ca8a4b657f8b1b4fb4" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="antlr4" version="4.9.2">
+         <artifact name="antlr4-4.9.2.jar">
+            <sha256 value="7d66253762da7c8c7ab6ac05da1471aeeb3cb8e92310ecfb08f939306b4c7dae" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="antlr4-runtime" version="4.10.1">
+         <artifact name="antlr4-runtime-4.10.1.jar">
+            <sha256 value="da66be0c98acfb29bc708300d05f1a3269c40f9984a4cb9251cf2ba1898d1334" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="antlr4-runtime" version="4.11.1">
+         <artifact name="antlr4-runtime-4.11.1.jar">
+            <sha256 value="e06c6553c1ccc14d36052ec4b0fc6f13b808cf957b5b1dc3f61bf401996ada59" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="antlr4-runtime" version="4.5.1-1">
+         <artifact name="antlr4-runtime-4.5.1-1.jar">
+            <sha256 value="ffca72bc2a25bb2b0c80a58cee60530a78be17da739bb6c91a8c2e3584ca099e" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.antlr" name="antlr4-runtime" version="4.5.3">
+         <artifact name="antlr4-runtime-4.5.3.jar">
+            <sha256 value="93bca08ec995caeaaf60bdf80035a0be8507fcdabd3c2618fd8c5aab4444a752" origin="Generated by Gradle"/>
          </artifact>
       </component>
       <component group="org.antlr" name="antlr4-runtime" version="4.9.2">
@@ -3492,34 +3474,29 @@
             <sha256 value="6cd91991323dd7b2fb28ca93d7ac12af5a86a2f53279e2b35827b30313fd0b9f" origin="Generated by Gradle"/>
          </artifact>
       </component>
-       <component group="org.fusesource.leveldbjni" name="leveldbjni-all" version="1.8">
-           <artifact name="leveldbjni-all-1.8.jar">
-               <sha256 value="c297213b0e6f9392305952753f3099a4c02e70b3656266fe01867e7b6c160ffe"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.glassfish" name="javax.json" version="1.0.4">
-           <artifact name="javax.json-1.0.4.jar">
-               <sha256 value="0e1dec40a1ede965941251eda968aeee052cc4f50378bc316cc48e8159bdbeb4"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.glassfish" name="javax.json" version="1.1.4">
-           <artifact name="javax.json-1.1.4.jar">
-               <sha256 value="17fdeb7e22375a7fb40bb0551306f6dcf2b5743078668adcdf6c642c9a9ec955"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.hamcrest" name="hamcrest" version="2.1">
-           <artifact name="hamcrest-2.1.jar">
-               <sha256 value="ba93b2e3a562322ba432f0a1b53addcc55cb188253319a020ed77f824e692050"
-                       origin="Generated by Gradle"/>
-           </artifact>
-       </component>
-       <component group="org.hamcrest" name="hamcrest" version="2.2">
-           <artifact name="hamcrest-2.2.jar">
-               <sha256 value="5e62846a89f05cd78cd9c1a553f340d002458380c320455dd1f8fc5497a8a1c1"
-                       origin="Generated by Gradle"/>
+      <component group="org.fusesource.leveldbjni" name="leveldbjni-all" version="1.8">
+         <artifact name="leveldbjni-all-1.8.jar">
+            <sha256 value="c297213b0e6f9392305952753f3099a4c02e70b3656266fe01867e7b6c160ffe" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.glassfish" name="javax.json" version="1.0.4">
+         <artifact name="javax.json-1.0.4.jar">
+            <sha256 value="0e1dec40a1ede965941251eda968aeee052cc4f50378bc316cc48e8159bdbeb4" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.glassfish" name="javax.json" version="1.1.4">
+         <artifact name="javax.json-1.1.4.jar">
+            <sha256 value="17fdeb7e22375a7fb40bb0551306f6dcf2b5743078668adcdf6c642c9a9ec955" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.hamcrest" name="hamcrest" version="2.1">
+         <artifact name="hamcrest-2.1.jar">
+            <sha256 value="ba93b2e3a562322ba432f0a1b53addcc55cb188253319a020ed77f824e692050" origin="Generated by Gradle"/>
+         </artifact>
+      </component>
+      <component group="org.hamcrest" name="hamcrest" version="2.2">
+         <artifact name="hamcrest-2.2.jar">
+            <sha256 value="5e62846a89f05cd78cd9c1a553f340d002458380c320455dd1f8fc5497a8a1c1" origin="Generated by Gradle"/>
          </artifact>
       </component>
       <component group="org.hamcrest" name="hamcrest-core" version="1.3">

+ 2 - 2
libs/x-content/impl/build.gradle

@@ -10,12 +10,12 @@ apply plugin: 'elasticsearch.java'
 
 archivesBaseName = "x-content-impl"
 
-String jacksonVersion = "2.14.1"
+String jacksonVersion = "2.14.2"
 
 dependencies {
   compileOnly project(':libs:elasticsearch-core')
   compileOnly project(':libs:elasticsearch-x-content')
-  implementation project(path: ':libs:x-content:impl:es-jackson-core', configuration: 'shadow')
+  implementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
   implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${jacksonVersion}"
   implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonVersion}"
   implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${jacksonVersion}"

+ 0 - 43
libs/x-content/impl/es-jackson-core/build.gradle

@@ -1,43 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-apply plugin: 'elasticsearch.build'
-apply plugin: 'com.github.johnrengelman.shadow'
-
-String jacksonVersion = "2.14.1"
-
-dependencies {
-  implementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
-}
-
-['jarHell', 'thirdPartyAudit', 'forbiddenApisMain', 'splitPackagesAudit', 'checkstyleMain', 'licenseHeaders', 'spotlessJavaCheck'].each {
-  tasks.named(it).configure {
-    enabled = false
-  }
-}
-
-pluginManager.withPlugin('com.diffplug.spotless') {
-  spotless {
-    java {
-      targetExclude "src/main/java/com/fasterxml/jackson/core/filter/FilteringParserDelegate.java"
-    }
-  }
-}
-
-tasks.named("dependencyLicenses").configure {
-  mapping from: /jackson-.*/, to: 'jackson'
-}
-
-shadowJar {
-  exclude { element ->
-    element.file == null && element.path.endsWith("FilteringParserDelegate.class")
-  }
-  manifest {
-    attributes 'Multi-Release' : 'true'
-  }
-}

+ 0 - 8
libs/x-content/impl/es-jackson-core/licenses/jackson-LICENSE.txt

@@ -1,8 +0,0 @@
-This copy of Jackson JSON processor streaming parser/generator is licensed under the
-Apache (Software) License, version 2.0 ("the License").
-See the License for details about distribution rights, and the
-specific rights regarding derivate works.
-
-You may obtain a copy of the License at:
-
-http://www.apache.org/licenses/LICENSE-2.0

+ 0 - 20
libs/x-content/impl/es-jackson-core/licenses/jackson-NOTICE.txt

@@ -1,20 +0,0 @@
-# Jackson JSON processor
-
-Jackson is a high-performance, Free/Open Source JSON processing library.
-It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has
-been in development since 2007.
-It is currently developed by a community of developers, as well as supported
-commercially by FasterXML.com.
-
-## Licensing
-
-Jackson core and extension components may licensed under different licenses.
-To find the details that apply to this artifact see the accompanying LICENSE file.
-For more information, including possible other licensing options, contact
-FasterXML.com (http://fasterxml.com).
-
-## Credits
-
-A list of contributors may be found from CREDITS file, which is included
-in some artifacts (usually source distributions); but is always available
-from the source code management (SCM) system project uses.

+ 0 - 1059
libs/x-content/impl/es-jackson-core/src/main/java/com/fasterxml/jackson/core/filter/FilteringParserDelegate.java

@@ -1,1059 +0,0 @@
-package com.fasterxml.jackson.core.filter;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import com.fasterxml.jackson.core.*;
-import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion;
-import com.fasterxml.jackson.core.util.JsonParserDelegate;
-
-import static com.fasterxml.jackson.core.JsonTokenId.*;
-
-/**
- * Specialized {@link JsonParserDelegate} that allows use of
- * {@link TokenFilter} for outputting a subset of content that
- * is visible to caller
- *
- * @since 2.6
- */
-public class FilteringParserDelegate extends JsonParserDelegate
-{
-    /*
-    /**********************************************************
-    /* Configuration
-    /**********************************************************
-     */
-
-    /**
-     * Object consulted to determine whether to write parts of content generator
-     * is asked to write or not.
-     */
-    protected TokenFilter rootFilter;
-
-    /**
-     * Flag that determines whether filtering will continue after the first
-     * match is indicated or not: if `false`, output is based on just the first
-     * full match (returning {@link TokenFilter#INCLUDE_ALL}) and no more
-     * checks are made; if `true` then filtering will be applied as necessary
-     * until end of content.
-     */
-    protected boolean _allowMultipleMatches;
-
-    /**
-     * Flag that determines whether path leading up to included content should
-     * also be automatically included or not. If `false`, no path inclusion is
-     * done and only explicitly included entries are output; if `true` then
-     * path from main level down to match is also included as necessary.
-     */
-    protected TokenFilter.Inclusion _inclusion;
-
-    /*
-    /**********************************************************
-    /* State
-    /**********************************************************
-     */
-
-    /**
-     * Last token retrieved via {@link #nextToken}, if any.
-     * Null before the first call to <code>nextToken()</code>,
-     * as well as if token has been explicitly cleared
-     */
-    protected JsonToken _currToken;
-
-    /**
-     * Last cleared token, if any: that is, value that was in
-     * effect when {@link #clearCurrentToken} was called.
-     */
-    protected JsonToken _lastClearedToken;
-
-    /**
-     * During traversal this is the actual "open" parse tree, which sometimes
-     * is the same as {@link #_exposedContext}, and at other times is ahead
-     * of it. Note that this context is never null.
-     */
-    protected TokenFilterContext _headContext;
-
-    /**
-     * In cases where {@link #_headContext} is "ahead" of context exposed to
-     * caller, this context points to what is currently exposed to caller.
-     * When the two are in sync, this context reference will be <code>null</code>.
-     */
-    protected TokenFilterContext _exposedContext;
-
-    /**
-     * State that applies to the item within container, used where applicable.
-     * Specifically used to pass inclusion state between property name and
-     * property, and also used for array elements.
-     */
-    protected TokenFilter _itemFilter;
-
-    /**
-     * Number of tokens for which {@link TokenFilter#INCLUDE_ALL}
-     * has been returned.
-     */
-    protected int _matchCount;
-
-    /*
-    /**********************************************************
-    /* Construction, initialization
-    /**********************************************************
-     */
-
-    @Deprecated
-    public FilteringParserDelegate(JsonParser p, TokenFilter f,
-                                   boolean includePath, boolean allowMultipleMatches)
-    {
-        this(p, f, includePath ? Inclusion.INCLUDE_ALL_AND_PATH : Inclusion.ONLY_INCLUDE_ALL, allowMultipleMatches);
-    }
-
-    /**
-     * @param p Parser to delegate calls to
-     * @param f Filter to use
-     * @param inclusion Definition of inclusion criteria
-     * @param allowMultipleMatches Whether to allow multiple matches
-     */
-    public FilteringParserDelegate(JsonParser p, TokenFilter f,
-                                   TokenFilter.Inclusion inclusion, boolean allowMultipleMatches)
-    {
-        super(p);
-        rootFilter = f;
-        // and this is the currently active filter for root values
-        _itemFilter = f;
-        _headContext = TokenFilterContext.createRootContext(f);
-        _inclusion = inclusion;
-        _allowMultipleMatches = allowMultipleMatches;
-    }
-
-    /*
-    /**********************************************************
-    /* Extended API
-    /**********************************************************
-     */
-
-    public TokenFilter getFilter() { return rootFilter; }
-
-    /**
-     * Accessor for finding number of matches, where specific token and sub-tree
-     * starting (if structured type) are passed.
-     *
-     * @return Number of matches
-     */
-    public int getMatchCount() {
-        return _matchCount;
-    }
-
-    /*
-    /**********************************************************
-    /* Public API, token accessors
-    /**********************************************************
-     */
-
-    @Override public JsonToken getCurrentToken() { return _currToken; }
-    @Override public JsonToken currentToken() { return _currToken; }
-
-    @Deprecated // since 2.12
-    @Override public final int getCurrentTokenId() {
-        return currentTokenId();
-    }
-    @Override public final int currentTokenId() {
-        final JsonToken t = _currToken;
-        return (t == null) ? JsonTokenId.ID_NO_TOKEN : t.id();
-    }
-
-    @Override public boolean hasCurrentToken() { return _currToken != null; }
-    @Override public boolean hasTokenId(int id) {
-        final JsonToken t = _currToken;
-        if (t == null) {
-            return (JsonTokenId.ID_NO_TOKEN == id);
-        }
-        return t.id() == id;
-    }
-
-    @Override public final boolean hasToken(JsonToken t) {
-        return (_currToken == t);
-    }
-
-    @Override public boolean isExpectedStartArrayToken() { return _currToken == JsonToken.START_ARRAY; }
-    @Override public boolean isExpectedStartObjectToken() { return _currToken == JsonToken.START_OBJECT; }
-
-    @Override public JsonLocation getCurrentLocation() { return delegate.getCurrentLocation(); }
-
-    @Override
-    public JsonStreamContext getParsingContext() {
-        return _filterContext();
-    }
-
-    // !!! TODO: Verify it works as expected: copied from standard JSON parser impl
-    @Override
-    public String getCurrentName() throws IOException {
-        JsonStreamContext ctxt = _filterContext();
-        if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
-            JsonStreamContext parent = ctxt.getParent();
-            return (parent == null) ? null : parent.getCurrentName();
-        }
-        return ctxt.getCurrentName();
-    }
-
-    // 2.13: IMPORTANT! Must override along with older getCurrentName()
-    @Override
-    public String currentName() throws IOException {
-        JsonStreamContext ctxt = _filterContext();
-        if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
-            JsonStreamContext parent = ctxt.getParent();
-            return (parent == null) ? null : parent.getCurrentName();
-        }
-        return ctxt.getCurrentName();
-    }
-
-    /*
-    /**********************************************************
-    /* Public API, token state overrides
-    /**********************************************************
-     */
-
-    @Override
-    public void clearCurrentToken() {
-        if (_currToken != null) {
-            _lastClearedToken = _currToken;
-            _currToken = null;
-        }
-    }
-
-    @Override
-    public JsonToken getLastClearedToken() { return _lastClearedToken; }
-
-    @Override
-    public void overrideCurrentName(String name) {
-        // 14-Apr-2015, tatu: Not sure whether this can be supported, and if so,
-        //    what to do with it... Delegation won't work for sure, so let's for
-        //    now throw an exception
-        throw new UnsupportedOperationException("Can not currently override name during filtering read");
-    }
-
-    /*
-    /**********************************************************
-    /* Public API, traversal
-    /**********************************************************
-     */
-
-    @Override
-    public JsonToken nextToken() throws IOException
-    {
-        // 23-May-2017, tatu: To be honest, code here is rather hairy and I don't like all
-        //    conditionals; and it seems odd to return `null` but NOT considering input
-        //    as closed... would love a rewrite to simplify/clear up logic here.
-
-        // Check for _allowMultipleMatches - false and at least there is one token - which is _currToken
-        // check for no buffered context _exposedContext - null
-        // If all the conditions matches then check for scalar / non-scalar property
-
-        if (!_allowMultipleMatches && (_currToken != null) && (_exposedContext == null)) {
-            // if scalar, and scalar not present in obj/array and _inclusion == ONLY_INCLUDE_ALL
-            // and INCLUDE_ALL matched once, return null
-            if (_currToken.isScalarValue() && !_headContext.isStartHandled()
-                && _inclusion == Inclusion.ONLY_INCLUDE_ALL
-                && (_itemFilter == TokenFilter.INCLUDE_ALL)) {
-                return (_currToken = null);
-            }
-        }
-        // Anything buffered?
-        TokenFilterContext ctxt = _exposedContext;
-
-        if (ctxt != null) {
-            while (true) {
-                JsonToken t = ctxt.nextTokenToRead();
-                if (t != null) {
-                    _currToken = t;
-                    return t;
-                }
-                // all done with buffered stuff?
-                if (ctxt == _headContext) {
-                    _exposedContext = null;
-                    if (ctxt.inArray()) {
-                        t = delegate.getCurrentToken();
-                        _currToken = t;
-                        if (_currToken == JsonToken.END_ARRAY) {
-                            _headContext = _headContext.getParent();
-                            _itemFilter = _headContext.getFilter();
-                        }
-                        return t;
-                    }
-
-                    // 19-Jul-2021, tatu: [core#700]: following was commented out?!
-                    // Almost! Most likely still have the current token;
-                    // with the sole exception of FIELD_NAME
-                    t = delegate.currentToken();
-                    if (t == JsonToken.END_OBJECT) {
-                        _headContext = _headContext.getParent();
-                        _itemFilter = _headContext.getFilter();
-                    }
-                    if (t != JsonToken.FIELD_NAME) {
-                        _currToken = t;
-                        return t;
-                    }
-                    break;
-                }
-                // If not, traverse down the context chain
-                ctxt = _headContext.findChildOf(ctxt);
-                _exposedContext = ctxt;
-                if (ctxt == null) { // should never occur
-                    throw _constructError("Unexpected problem: chain of filtered context broken");
-                }
-            }
-        }
-
-        // If not, need to read more. If we got any:
-        JsonToken t = delegate.nextToken();
-        if (t == null) {
-            // no strict need to close, since we have no state here
-            _currToken = t;
-            return t;
-        }
-
-        // otherwise... to include or not?
-        TokenFilter f;
-
-        switch (t.id()) {
-            case ID_START_ARRAY:
-                f = _itemFilter;
-                if (f == TokenFilter.INCLUDE_ALL) {
-                    _headContext = _headContext.createChildArrayContext(f, true);
-                    return (_currToken = t);
-                }
-                if (f == null) { // does this occur?
-                    delegate.skipChildren();
-                    break;
-                }
-                // Otherwise still iffy, need to check
-                f = _headContext.checkValue(f);
-                if (f == null) {
-                    delegate.skipChildren();
-                    break;
-                }
-                if (f != TokenFilter.INCLUDE_ALL) {
-                    f = f.filterStartArray();
-                }
-                _itemFilter = f;
-                if (f == TokenFilter.INCLUDE_ALL) {
-                    _headContext = _headContext.createChildArrayContext(f, true);
-                    return (_currToken = t);
-                } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) {
-                    // TODO don't count as match?
-                    _headContext = _headContext.createChildArrayContext(f, true);
-                    return (_currToken = t);
-                }
-                _headContext = _headContext.createChildArrayContext(f, false);
-
-                // Also: only need buffering if parent path to be included
-                if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) {
-                    t = _nextTokenWithBuffering(_headContext);
-                    if (t != null) {
-                        _currToken = t;
-                        return t;
-                    }
-                }
-                break;
-
-            case ID_START_OBJECT:
-                f = _itemFilter;
-                if (f == TokenFilter.INCLUDE_ALL) {
-                    _headContext = _headContext.createChildObjectContext(f, true);
-                    return (_currToken = t);
-                }
-                if (f == null) { // does this occur?
-                    delegate.skipChildren();
-                    break;
-                }
-                // Otherwise still iffy, need to check
-                f = _headContext.checkValue(f);
-                if (f == null) {
-                    delegate.skipChildren();
-                    break;
-                }
-                if (f != TokenFilter.INCLUDE_ALL) {
-                    f = f.filterStartObject();
-                }
-                _itemFilter = f;
-                if (f == TokenFilter.INCLUDE_ALL) {
-                    _headContext = _headContext.createChildObjectContext(f, true);
-                    return (_currToken = t);
-                } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) {
-                    // TODO don't count as match?
-                    _headContext = _headContext.createChildObjectContext(f, true);
-                    return (_currToken = t);
-                }
-                _headContext = _headContext.createChildObjectContext(f, false);
-                // Also: only need buffering if parent path to be included
-                if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) {
-                    t = _nextTokenWithBuffering(_headContext);
-                    if (t != null) {
-                        _currToken = t;
-                        return t;
-                    }
-                }
-                // note: inclusion of surrounding Object handled separately via
-                // FIELD_NAME
-                break;
-
-            case ID_END_ARRAY:
-            case ID_END_OBJECT:
-            {
-                boolean returnEnd = _headContext.isStartHandled();
-                f = _headContext.getFilter();
-                if ((f != null) && (f != TokenFilter.INCLUDE_ALL)) {
-                    f.filterFinishArray();
-                }
-                _headContext = _headContext.getParent();
-                _itemFilter = _headContext.getFilter();
-                if (returnEnd) {
-                    return (_currToken = t);
-                }
-            }
-            break;
-
-            case ID_FIELD_NAME:
-            {
-                final String name = delegate.getCurrentName();
-                // note: this will also set 'needToHandleName'
-                f = _headContext.setFieldName(name);
-                if (f == TokenFilter.INCLUDE_ALL) {
-                    _itemFilter = f;
-                    return (_currToken = t);
-                }
-                if (f == null) {
-                    delegate.nextToken();
-                    delegate.skipChildren();
-                    break;
-                }
-                f = f.includeProperty(name);
-                if (f == null) {
-                    delegate.nextToken();
-                    delegate.skipChildren();
-                    break;
-                }
-                _itemFilter = f;
-                if (f == TokenFilter.INCLUDE_ALL) {
-                    if (_verifyAllowedMatches()) {
-                        if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) {
-                            return (_currToken = t);
-                        }
-                    } else {
-                        delegate.nextToken();
-                        delegate.skipChildren();
-                    }
-                }
-                if (_inclusion != Inclusion.ONLY_INCLUDE_ALL) {
-                    t = _nextTokenWithBuffering(_headContext);
-                    if (t != null) {
-                        _currToken = t;
-                        return t;
-                    }
-                }
-                break;
-            }
-
-            default: // scalar value
-                f = _itemFilter;
-                if (f == TokenFilter.INCLUDE_ALL) {
-                    return (_currToken = t);
-                }
-                if (f != null) {
-                    f = _headContext.checkValue(f);
-                    if ((f == TokenFilter.INCLUDE_ALL)
-                        || ((f != null) && f.includeValue(delegate))) {
-                        if (_verifyAllowedMatches()) {
-                            return (_currToken = t);
-                        }
-                    }
-                }
-                // Otherwise not included (leaves must be explicitly included)
-                break;
-        }
-
-        // We get here if token was not yet found; offlined handling
-        return _nextToken2();
-    }
-
-    // Offlined handling for cases where there was no buffered token to
-    // return, and the token read next could not be returned as-is,
-    // at least not yet, but where we have not yet established that
-    // buffering is needed.
-    protected final JsonToken _nextToken2() throws IOException
-    {
-        main_loop:
-        while (true) {
-            JsonToken t = delegate.nextToken();
-            if (t == null) { // is this even legal?
-                _currToken = t;
-                return t;
-            }
-            TokenFilter f;
-
-            switch (t.id()) {
-                case ID_START_ARRAY:
-                    f = _itemFilter;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        _headContext = _headContext.createChildArrayContext(f, true);
-                        return (_currToken = t);
-                    }
-                    if (f == null) { // does this occur?
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    // Otherwise still iffy, need to check
-                    f = _headContext.checkValue(f);
-                    if (f == null) {
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    if (f != TokenFilter.INCLUDE_ALL) {
-                        f = f.filterStartArray();
-                    }
-                    _itemFilter = f;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        _headContext = _headContext.createChildArrayContext(f, true);
-                        return (_currToken = t);
-                    } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) {
-                        _headContext = _headContext.createChildArrayContext(f, true);
-                        return (_currToken = t);
-                    }
-                    _headContext = _headContext.createChildArrayContext(f, false);
-                    // but if we didn't figure it out yet, need to buffer possible events
-                    if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) {
-                        t = _nextTokenWithBuffering(_headContext);
-                        if (t != null) {
-                            _currToken = t;
-                            return t;
-                        }
-                    }
-                    continue main_loop;
-
-                case ID_START_OBJECT:
-                    f = _itemFilter;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        _headContext = _headContext.createChildObjectContext(f, true);
-                        return (_currToken = t);
-                    }
-                    if (f == null) { // does this occur?
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    // Otherwise still iffy, need to check
-                    f = _headContext.checkValue(f);
-                    if (f == null) {
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    if (f != TokenFilter.INCLUDE_ALL) {
-                        f = f.filterStartObject();
-                    }
-                    _itemFilter = f;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        _headContext = _headContext.createChildObjectContext(f, true);
-                        return (_currToken = t);
-                    } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) {
-                        _headContext = _headContext.createChildObjectContext(f, true);
-                        return (_currToken = t);
-                    }
-                    _headContext = _headContext.createChildObjectContext(f, false);
-                    if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) {
-                        t = _nextTokenWithBuffering(_headContext);
-                        if (t != null) {
-                            _currToken = t;
-                            return t;
-                        }
-                    }
-                    continue main_loop;
-
-                case ID_END_ARRAY:
-                {
-                    boolean returnEnd = _headContext.isStartHandled();
-                    f = _headContext.getFilter();
-                    if ((f != null) && (f != TokenFilter.INCLUDE_ALL)) {
-                        boolean includeEmpty = f.includeEmptyArray(_headContext.hasCurrentIndex());
-                        f.filterFinishArray();
-                        if (includeEmpty) {
-                            return _nextBuffered(_headContext);
-                        }
-                    }
-                    _headContext = _headContext.getParent();
-                    _itemFilter = _headContext.getFilter();
-                    if (returnEnd) {
-                        return (_currToken = t);
-                    }
-                }
-                continue main_loop;
-                case ID_END_OBJECT:
-                {
-                    boolean returnEnd = _headContext.isStartHandled();
-                    f = _headContext.getFilter();
-                    if ((f != null) && (f != TokenFilter.INCLUDE_ALL)) {
-                        boolean includeEmpty = f.includeEmptyArray(_headContext.hasCurrentName());
-                        f.filterFinishObject();
-                        if (includeEmpty) {
-                            return _nextBuffered(_headContext);
-                        }                    }
-                    _headContext = _headContext.getParent();
-                    _itemFilter = _headContext.getFilter();
-                    if (returnEnd) {
-                        return (_currToken = t);
-                    }
-                }
-                continue main_loop;
-
-                case ID_FIELD_NAME:
-                {
-                    final String name = delegate.getCurrentName();
-                    f = _headContext.setFieldName(name);
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        _itemFilter = f;
-                        return (_currToken = t);
-                    }
-                    if (f == null) { // filter out the value
-                        delegate.nextToken();
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    f = f.includeProperty(name);
-                    if (f == null) { // filter out the value
-                        delegate.nextToken();
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    _itemFilter = f;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        if (_verifyAllowedMatches()) {
-                            if (_inclusion == Inclusion.INCLUDE_ALL_AND_PATH) {
-                                return (_currToken = t);
-                            }
-                        } else {
-                            delegate.nextToken();
-                            delegate.skipChildren();
-                        }
-                        continue main_loop;
-                    }
-                    if (_inclusion != Inclusion.ONLY_INCLUDE_ALL) {
-                        t = _nextTokenWithBuffering(_headContext);
-                        if (t != null) {
-                            _currToken = t;
-                            return t;
-                        }
-                    }
-                }
-                continue main_loop;
-
-                default: // scalar value
-                    f = _itemFilter;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        return (_currToken = t);
-                    }
-                    if (f != null) {
-                        f = _headContext.checkValue(f);
-                        if ((f == TokenFilter.INCLUDE_ALL)
-                            || ((f != null) && f.includeValue(delegate))) {
-                            if (_verifyAllowedMatches()) {
-                                return (_currToken = t);
-                            }
-                        }
-                    }
-                    // Otherwise not included (leaves must be explicitly included)
-                    break;
-            }
-        }
-    }
-
-    // Method called when a new potentially included context is found.
-    protected final JsonToken _nextTokenWithBuffering(final TokenFilterContext buffRoot)
-        throws IOException
-    {
-        main_loop:
-        while (true) {
-            JsonToken t = delegate.nextToken();
-            if (t == null) { // is this even legal?
-                return t;
-            }
-            TokenFilter f;
-
-            // One simplification here: we know for a fact that the item filter is
-            // neither null nor 'include all', for most cases; the only exception
-            // being FIELD_NAME handling
-
-            switch (t.id()) {
-                case ID_START_ARRAY:
-                    f = _headContext.checkValue(_itemFilter);
-                    if (f == null) {
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    if (f != TokenFilter.INCLUDE_ALL) {
-                        f = f.filterStartArray();
-                    }
-                    _itemFilter = f;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        _headContext = _headContext.createChildArrayContext(f, true);
-                        return _nextBuffered(buffRoot);
-                    } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) {
-                        // TODO don't count as match?
-                        _headContext = _headContext.createChildArrayContext(f, true);
-                        return _nextBuffered(buffRoot);
-                    }
-                    _headContext = _headContext.createChildArrayContext(f, false);
-                    continue main_loop;
-
-                case ID_START_OBJECT:
-                    f = _itemFilter;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        _headContext = _headContext.createChildObjectContext(f, true);
-                        return t;
-                    }
-                    if (f == null) { // does this occur?
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    // Otherwise still iffy, need to check
-                    f = _headContext.checkValue(f);
-                    if (f == null) {
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    if (f != TokenFilter.INCLUDE_ALL) {
-                        f = f.filterStartObject();
-                    }
-                    _itemFilter = f;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        _headContext = _headContext.createChildObjectContext(f, true);
-                        return _nextBuffered(buffRoot);
-                    } else if (f != null && _inclusion == Inclusion.INCLUDE_NON_NULL) {
-                        // TODO don't count as match?
-                        _headContext = _headContext.createChildArrayContext(f, true);
-                        return _nextBuffered(buffRoot);
-                    }
-                    _headContext = _headContext.createChildObjectContext(f, false);
-                    continue main_loop;
-
-                case ID_END_ARRAY:
-                {
-                    // Unlike with other loops, here we know that content was NOT
-                    // included (won't get this far otherwise)
-                    f = _headContext.getFilter();
-                    if ((f != null) && (f != TokenFilter.INCLUDE_ALL)) {
-                        boolean includeEmpty = f.includeEmptyArray(_headContext.hasCurrentIndex());
-                        f.filterFinishArray();
-                        if (includeEmpty) {
-                            return _nextBuffered(buffRoot);
-                        }
-                    }
-                    boolean gotEnd = (_headContext == buffRoot);
-                    boolean returnEnd = gotEnd && _headContext.isStartHandled();
-
-                    _headContext = _headContext.getParent();
-                    _itemFilter = _headContext.getFilter();
-
-                    if (returnEnd) {
-                        return t;
-                    }
-                    if (gotEnd) {
-                        return null;
-                    }
-                }
-                continue main_loop;
-                case ID_END_OBJECT:
-                {
-                    // Unlike with other loops, here we know that content was NOT
-                    // included (won't get this far otherwise)
-                    f = _headContext.getFilter();
-                    if ((f != null) && (f != TokenFilter.INCLUDE_ALL)) {
-                        boolean includeEmpty = f.includeEmptyObject(_headContext.hasCurrentName());
-                        f.filterFinishObject();
-                        if (includeEmpty) {
-                            _headContext._currentName = _headContext._parent == null
-                                ? null
-                                : _headContext._parent._currentName;
-                            _headContext._needToHandleName = false;
-                            return _nextBuffered(buffRoot);
-                        }
-                    }
-                    boolean gotEnd = (_headContext == buffRoot);
-                    boolean returnEnd = gotEnd && _headContext.isStartHandled();
-
-                    _headContext = _headContext.getParent();
-                    _itemFilter = _headContext.getFilter();
-
-                    if (returnEnd) {
-                        return t;
-                    }
-                    if (gotEnd) {
-                        return null;
-                    }
-                }
-                continue main_loop;
-
-                case ID_FIELD_NAME:
-                {
-                    final String name = delegate.getCurrentName();
-                    f = _headContext.setFieldName(name);
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        _itemFilter = f;
-                        return _nextBuffered(buffRoot);
-                    }
-                    if (f == null) { // filter out the value
-                        delegate.nextToken();
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    f = f.includeProperty(name);
-                    if (f == null) { // filter out the value
-                        delegate.nextToken();
-                        delegate.skipChildren();
-                        continue main_loop;
-                    }
-                    _itemFilter = f;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        if (_verifyAllowedMatches()) {
-                            return _nextBuffered(buffRoot);
-                        } else {
-                            // edge case: if no more matches allowed, reset filter
-                            // to initial state to prevent missing a token in next iteration
-                            _itemFilter = _headContext.setFieldName(name);
-                        }
-                    }
-                }
-                continue main_loop;
-
-                default: // scalar value
-                    f = _itemFilter;
-                    if (f == TokenFilter.INCLUDE_ALL) {
-                        return _nextBuffered(buffRoot);
-                    }
-                    if (f != null) {
-                        f = _headContext.checkValue(f);
-                        if ((f == TokenFilter.INCLUDE_ALL)
-                            || ((f != null) && f.includeValue(delegate))) {
-                            if (_verifyAllowedMatches()) {
-                                return _nextBuffered(buffRoot);
-                            }
-                        }
-                    }
-                    // Otherwise not included (leaves must be explicitly included)
-                    continue main_loop;
-            }
-        }
-    }
-
-    private JsonToken _nextBuffered(TokenFilterContext buffRoot) throws IOException
-    {
-        _exposedContext = buffRoot;
-        TokenFilterContext ctxt = buffRoot;
-        JsonToken t = ctxt.nextTokenToRead();
-        if (t != null) {
-            return t;
-        }
-        while (true) {
-            // all done with buffered stuff?
-            if (ctxt == _headContext) {
-                throw _constructError("Internal error: failed to locate expected buffered tokens");
-                /*
-                _exposedContext = null;
-                break;
-                */
-            }
-            // If not, traverse down the context chain
-            ctxt = _exposedContext.findChildOf(ctxt);
-            _exposedContext = ctxt;
-            if (ctxt == null) { // should never occur
-                throw _constructError("Unexpected problem: chain of filtered context broken");
-            }
-            t = _exposedContext.nextTokenToRead();
-            if (t != null) {
-                return t;
-            }
-        }
-    }
-
-    private final boolean _verifyAllowedMatches() throws IOException {
-        if (_matchCount == 0 || _allowMultipleMatches) {
-            ++_matchCount;
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public JsonToken nextValue() throws IOException {
-        // Re-implemented same as ParserMinimalBase:
-        JsonToken t = nextToken();
-        if (t == JsonToken.FIELD_NAME) {
-            t = nextToken();
-        }
-        return t;
-    }
-
-    /**
-     * Need to override, re-implement similar to how method defined in
-     * {@link com.fasterxml.jackson.core.base.ParserMinimalBase}, to keep
-     * state correct here.
-     */
-    @Override
-    public JsonParser skipChildren() throws IOException
-    {
-        if ((_currToken != JsonToken.START_OBJECT)
-            && (_currToken != JsonToken.START_ARRAY)) {
-            return this;
-        }
-        int open = 1;
-
-        // Since proper matching of start/end markers is handled
-        // by nextToken(), we'll just count nesting levels here
-        while (true) {
-            JsonToken t = nextToken();
-            if (t == null) { // not ideal but for now, just return
-                return this;
-            }
-            if (t.isStructStart()) {
-                ++open;
-            } else if (t.isStructEnd()) {
-                if (--open == 0) {
-                    return this;
-                }
-            }
-        }
-    }
-
-    /*
-    /**********************************************************
-    /* Public API, access to token information, text
-    /**********************************************************
-     */
-
-    // 19-Jul-2021, tatu: Cannot quite just delegate these methods due to oddity
-    //   of property name token, which may be buffered.
-
-    @Override public String getText() throws IOException {
-        if (_currToken == JsonToken.FIELD_NAME) {
-            return currentName();
-        }
-        return delegate.getText();
-    }
-
-    @Override public boolean hasTextCharacters() {
-        if (_currToken == JsonToken.FIELD_NAME) {
-            return false;
-        }
-        return delegate.hasTextCharacters();
-    }
-
-    @Override public char[] getTextCharacters() throws IOException {
-        // Not optimal but is correct, unlike delegating (as underlying stream
-        // may point to something else due to buffering)
-        if (_currToken == JsonToken.FIELD_NAME) {
-            return currentName().toCharArray();
-        }
-        return delegate.getTextCharacters();
-    }
-
-    @Override public int getTextLength() throws IOException {
-        if (_currToken == JsonToken.FIELD_NAME) {
-            return currentName().length();
-        }
-        return delegate.getTextLength();
-    }
-    @Override public int getTextOffset() throws IOException {
-        if (_currToken == JsonToken.FIELD_NAME) {
-            return 0;
-        }
-        return delegate.getTextOffset();
-    }
-
-    /*
-    /**********************************************************
-    /* Public API, access to token information, numeric
-    /**********************************************************
-     */
-
-    @Override
-    public BigInteger getBigIntegerValue() throws IOException { return delegate.getBigIntegerValue(); }
-
-    @Override
-    public boolean getBooleanValue() throws IOException { return delegate.getBooleanValue(); }
-
-    @Override
-    public byte getByteValue() throws IOException { return delegate.getByteValue(); }
-
-    @Override
-    public short getShortValue() throws IOException { return delegate.getShortValue(); }
-
-    @Override
-    public BigDecimal getDecimalValue() throws IOException { return delegate.getDecimalValue(); }
-
-    @Override
-    public double getDoubleValue() throws IOException { return delegate.getDoubleValue(); }
-
-    @Override
-    public float getFloatValue() throws IOException { return delegate.getFloatValue(); }
-
-    @Override
-    public int getIntValue() throws IOException { return delegate.getIntValue(); }
-
-    @Override
-    public long getLongValue() throws IOException { return delegate.getLongValue(); }
-
-    @Override
-    public NumberType getNumberType() throws IOException { return delegate.getNumberType(); }
-
-    @Override
-    public Number getNumberValue() throws IOException { return delegate.getNumberValue(); }
-
-    /*
-    /**********************************************************
-    /* Public API, access to token information, coercion/conversion
-    /**********************************************************
-     */
-
-    @Override public int getValueAsInt() throws IOException { return delegate.getValueAsInt(); }
-    @Override public int getValueAsInt(int defaultValue) throws IOException { return delegate.getValueAsInt(defaultValue); }
-    @Override public long getValueAsLong() throws IOException { return delegate.getValueAsLong(); }
-    @Override public long getValueAsLong(long defaultValue) throws IOException { return delegate.getValueAsLong(defaultValue); }
-    @Override public double getValueAsDouble() throws IOException { return delegate.getValueAsDouble(); }
-    @Override public double getValueAsDouble(double defaultValue) throws IOException { return delegate.getValueAsDouble(defaultValue); }
-    @Override public boolean getValueAsBoolean() throws IOException { return delegate.getValueAsBoolean(); }
-    @Override public boolean getValueAsBoolean(boolean defaultValue) throws IOException { return delegate.getValueAsBoolean(defaultValue); }
-
-    @Override public String getValueAsString() throws IOException {
-        if (_currToken == JsonToken.FIELD_NAME) {
-            return currentName();
-        }
-        return delegate.getValueAsString();
-    }
-    @Override public String getValueAsString(String defaultValue) throws IOException {
-        if (_currToken == JsonToken.FIELD_NAME) {
-            return currentName();
-        }
-        return delegate.getValueAsString(defaultValue);
-    }
-
-    /*
-    /**********************************************************
-    /* Public API, access to token values, other
-    /**********************************************************
-     */
-
-    @Override public Object getEmbeddedObject() throws IOException { return delegate.getEmbeddedObject(); }
-    @Override public byte[] getBinaryValue(Base64Variant b64variant) throws IOException { return delegate.getBinaryValue(b64variant); }
-    @Override public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException { return delegate.readBinaryValue(b64variant, out); }
-    @Override public JsonLocation getTokenLocation() { return delegate.getTokenLocation(); }
-
-    /*
-    /**********************************************************
-    /* Internal helper methods
-    /**********************************************************
-     */
-
-    protected JsonStreamContext _filterContext() {
-        if (_exposedContext != null) {
-            return _exposedContext;
-        }
-        return _headContext;
-    }
-}