Skip to content

Commit 12618bb

Browse files
committed
Fix FasterXML#1015: JsonFactory always respects CANONICALIZE_FIELD_NAMES
Previously a subset of methods did not check for `CANONICALIZE_FIELD_NAMES` in the factory features configuration.
1 parent b472243 commit 12618bb

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/main/java/com/fasterxml/jackson/core/JsonFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ public JsonParser createNonBlockingByteArrayParser() throws IOException
12991299
// for non-JSON input:
13001300
_requireJSONFactory("Non-blocking source not (yet?) supported for this format (%s)");
13011301
IOContext ctxt = _createNonBlockingContext(null);
1302-
ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChild(_factoryFeatures);
1302+
ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChildOrPlaceholder(_factoryFeatures);
13031303
return new NonBlockingJsonParser(ctxt, _parserFeatures, can);
13041304
}
13051305

@@ -1326,7 +1326,7 @@ public JsonParser createNonBlockingByteBufferParser() throws IOException
13261326
// for non-JSON input:
13271327
_requireJSONFactory("Non-blocking source not (yet?) supported for this format (%s)");
13281328
IOContext ctxt = _createNonBlockingContext(null);
1329-
ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChild(_factoryFeatures);
1329+
ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChildOrPlaceholder(_factoryFeatures);
13301330
return new NonBlockingByteBufferJsonParser(ctxt, _parserFeatures, can);
13311331
}
13321332

@@ -1849,7 +1849,7 @@ protected JsonParser _createParser(DataInput input, IOContext ctxt) throws IOExc
18491849
// Also: while we can't do full bootstrapping (due to read-ahead limitations), should
18501850
// at least handle possible UTF-8 BOM
18511851
int firstByte = ByteSourceJsonBootstrapper.skipUTF8BOM(input);
1852-
ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChild(_factoryFeatures);
1852+
ByteQuadsCanonicalizer can = _byteSymbolCanonicalizer.makeChildOrPlaceholder(_factoryFeatures);
18531853
return new UTF8DataInputJsonParser(ctxt, _parserFeatures, input,
18541854
_objectCodec, can, firstByte);
18551855
}

src/main/java/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,6 +1933,9 @@ private final String addName(int[] quads, int qlen, int lastQuadBytes)
19331933

19341934
// Ok. Now we have the character array, and can construct the String
19351935
String baseName = new String(cbuf, 0, cix);
1936+
if (!_symbols.isCanonicalizing()) {
1937+
return baseName;
1938+
}
19361939
// And finally, un-align if necessary
19371940
if (lastQuadBytes < 4) {
19381941
quads[qlen-1] = lastQuad;

src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParserBase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,9 @@ protected final String _addName(int[] quads, int qlen, int lastQuadBytes)
790790

791791
// Ok. Now we have the character array, and can construct the String
792792
String baseName = new String(cbuf, 0, cix);
793+
if (!_symbols.isCanonicalizing()) {
794+
return baseName;
795+
}
793796
// And finally, un-align if necessary
794797
if (lastQuadBytes < 4) {
795798
quads[qlen-1] = lastQuad;

0 commit comments

Comments
 (0)