Fix NPE in currentNameMatch/nextNameMatch when PropertyNameMatcher is null [databind#5811]#1578
Closed
Fix NPE in currentNameMatch/nextNameMatch when PropertyNameMatcher is null [databind#5811]#1578
currentNameMatch/nextNameMatch when PropertyNameMatcher is null [databind#5811]#1578Conversation
…atabind#5811] Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [JACKSON-5811] Fix NPE and add test coverage
Fix NPE in Mar 18, 2026
currentNameMatch/nextNameMatch when PropertyNameMatcher is null [databind#5811]
Member
|
No, this is wrong kind of defensive coding. Name matcher must be set and we should not sprinkle null checks all over codebase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
ObjectMapper.convertValue()is used with a custom deserializer wrapping aBeanDeserializer, the inner deserializer's_nameMatchercan be null at deserialization time, causing an NPE whenBeanDeserializerpasses it top.currentNameMatch(null).Changes
ParserMinimalBase— null-guard in bothcurrentNameMatch()andnextNameMatch(): returnMATCH_UNKNOWN_NAMEwhenmatcher == nulland current token isPROPERTY_NAME, allowing callers to fall back to slow-path string-based matchingUTF8StreamJsonParser— null-guard in the optimizednextNameMatch(): skip quad-based fast path, parse name normally, returnMATCH_UNKNOWN_NAMEJsonParserSequence/FilteringParserDelegate— same null-guard in theirnextNameMatch()overridesNextNameWithMatcherTest— added@Testannotations (existing tests were not being discovered by JUnit 5), addedtestNullMatcherNextNameMatchandtestNullMatcherCurrentNameMatchcovering all parser modesBehavior when
matcherisnullPROPERTY_NAMEMATCH_UNKNOWN_NAMEEND_OBJECTMATCH_END_OBJECTMATCH_ODD_TOKENWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
central.sonatype.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.13/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.13/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.13 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.13/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/jackson-core/jackson-core org.codehaus.plexus.classworlds.launcher.Launcher test -pl . -Dtest=NextNameWithMatcherTest -q jackson/core/JsonParser.java jackson/core/it/ModuleInfoIT.java jackson/core/it/iptables jackson/core/uni-w jackson/core/uni-t jackson/core/unisecurity(dns block)/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /home/REDACTED/.m2/wrapper/dists/apache-maven-3.9.11/a2d47e15/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/home/REDACTED/.m2/wrapper/dists/apache-maven-3.9.11/a2d47e15/bin/m2.conf -Dmaven.home=/home/REDACTED/.m2/wrapper/dists/apache-maven-3.9.11/a2d47e15 -Dlibrary.jansi.path=/home/REDACTED/.m2/wrapper/dists/apache-maven-3.9.11/a2d47e15/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/jackson-core/jackson-core org.codehaus.plexus.classworlds.launcher.Launcher test -Dtest=NextNameWithMatcherTest -q(dns block)/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.13/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.13/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.13 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.13/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/jackson-core/jackson-core org.codehaus.plexus.classworlds.launcher.Launcher test -Dtest=NextNameWithMatcherTest -q --no-transfer-progress -Dmaven.repo.local=/home/REDACTED/.m2/repository(dns block)https://api.github.com/repos/FasterXML/jackson-base/branches/usr/bin/curl curl -s REDACTED(http block)https://api.github.com/repos/FasterXML/jackson-base/contents/pom.xml/usr/bin/curl curl -s REDACTED(http block)https://api.github.com/repos/FasterXML/jackson-parent/branches/usr/bin/curl curl -s REDACTED(http block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.