Closed
Description
More from randomized testing: deserializing the document { "\u0000abc" : "a", "abc" : "b" }
via the UTF8StreamJsonParser will produce the same text for the second field name as the first. This is because the BytesToNameCanonicalizer will left-pad "abc" with a 0 byte to fit it in an int, which is indistinguishable from a string which really has a leading zero char.
Here's a standalone test case for it:
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
public class Tokens {
public static void main(String[] args) throws Exception {
String[] expectedTexts = { "{", "\u0000abc", "a", "abc", "b", "}" };
JsonParser parser = new JsonFactory().createParser("{\"\\u0000abc\" : \"a\", \"abc\" : \"b\"}".getBytes());
for(String expected : expectedTexts) {
parser.nextToken();
if(!parser.getText().equals(expected)) throw new Exception(parser.getText() + " != " + expected);
}
}
}
Metadata
Metadata
Assignees
Labels
No labels