Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
2.3.1, 2.3.2, 2.3.3, 2.3.4
-
None
-
Groovy Version: 2.3.3 JVM: 1.8.0_05 Vendor: Oracle Corporation OS: Linux
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
Description
Json serialiation with Greek characters fails
To reproduce:
Object o1 = ["ΑΦÎÎ ÎÎÎÎÎΑ ÎΡÎΩΠÎÎÎÎΠΤΑΒÎΡÎΑ"] println "o1=${new JsonBuilder(o1).toString()}" Object o2 = ["ΑΦÎÎ ÎÎÎÎÎΑ ÎΡÎΩΠÎÎÎÎΠΤΑΒÎΡÎΑ", "ÎαλÏβια ÎοÏικοÏ"] println "o2=${new JsonBuilder(o2).toString()}"
Outputs:
o1=["\u0391\u03a6\u039f\u0399 \u039a\u039f\u039b\u039b\u0399\u0391 \u039a\u03a1\u0395\u03a9\u03a0\u039f\u039b\u0395\u0399\u039f \u03a4\u0391\u0392\u0395\u03a1\u039d\u0391"] Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 255 at groovy.json.internal.CharBuf.doAddJsonEscapedString(CharBuf.java:533) at groovy.json.internal.CharBuf.addJsonEscapedString(CharBuf.java:394) at groovy.json.internal.CharBuf.addJsonEscapedString(CharBuf.java:357) at groovy.json.JsonOutput.writeCharSequence(JsonOutput.java:309) at groovy.json.JsonOutput.writeObject(JsonOutput.java:260) at groovy.json.JsonOutput.writeIterator(JsonOutput.java:446) at groovy.json.JsonOutput.writeObject(JsonOutput.java:272) at groovy.json.JsonOutput.toJson(JsonOutput.java:190) at groovy.json.JsonBuilder.toString(JsonBuilder.groovy:273) at groovy.json.JsonBuilder$toString.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112) at Draft.main(Draft.groovy:37)