Affects Version/s: 6.2.X EE, 7.0.0 DXP SP1
If a JSONObject.toString() results in a string larger than 65535 characters and the JSONObject is being serialized, an UTFDataFormatExeption is thrown.
It looks like this is because JSONObjectImpl.writeExternal uses objectOutput.writeUTF which has a hard limit of 65535 bytes. There's a similar constraint in readInternal.
This issue is reproduced with JSONArray as well.
Steps to Reproduce:
- Start a Liferay Instance.
- Navigate to Control Panel > Server Administration > Script.
- Run the attached Groovy Script: test_jsonobject_jsonarray_externalizable.groovy
Script runs successfully for both JSONObject and JSONArray.
Script fails: java.io.UTFDataFormatException