Details
Description
Hello,
We have found incorrect parsing of "{" within JSON strings. It seems like the parser searches for "
{" and "}" regardless of string boundary.
A reproduction program is attached, using latest 3.1.12 version.
Thanks!
REPRODUCTION
import org.apache.cxf.jaxrs.json.basic.JsonMapObjectReaderWriter; public class JsonMapReaderNotWorking { public static void main(String args[]) throws Exception { JsonMapObjectReaderWriter jsonMapObjectReaderWriter = new JsonMapObjectReaderWriter(); String s = "{\"x\":{\"y\":\"{\"}}"; System.out.println(s); jsonMapObjectReaderWriter.fromJson(s); } }
RESULT
{"x":{"y":"{"}} Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -6 at java.lang.String.substring(String.java:1967) at org.apache.cxf.jaxrs.json.basic.JsonMapObjectReaderWriter.readJsonObjectAsSettable(JsonMapObjectReaderWriter.java:189) at org.apache.cxf.jaxrs.json.basic.JsonMapObjectReaderWriter.fromJson(JsonMapObjectReaderWriter.java:162) at JsonMapReaderNotWorking.main(JsonMapReaderNotWorking.java:13)