Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-67824

Large JSON Objects cannot be properly serialized and result in UTFDataFormatException

    Details

      Description

      Description:
      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:

      1. Start a Liferay Instance.
      2. Navigate to Control Panel > Server Administration > Script.
      3. Run the attached Groovy Script: test_jsonobject_jsonarray_externalizable.groovy

      Expected:
      Script runs successfully for both JSONObject and JSONArray.

      Actual:
      Script fails: java.io.UTFDataFormatException

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 44 weeks, 3 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 DXP FP3
                  7.0.0 DXP SP1
                  Master