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

JSON exception from date type expando field, value not correctly quoted for JSON

    Details

    • Fix Priority:
      3

      Description

      When you have a custom field of type Date and you try to get it using ExpandoValueServiceSoap.getJSONData method it fails to exception com.liferay.portal.kernel.json.JSONException: org.json.JSONException: Expected a ',' or '}'.
      It si because the value is not quoted, as I understand it should be?

      {data:Wed Aug 27 10:52:44 GMT 2014}

      should be

      {data:"Wed Aug 27 10:52:44 GMT 2014"}

      Steps to reproduce:
      1. Create a custom field of type Date
      2. assign a value for it
      3. Write a soap/json call to it using ExpandoValueServiceSoap.getJsonData method

      log trace:
      [http-bio-8082-exec-22][ExpandoValueServiceSoap:112] com.liferay.portal.kernel.json.JSONException: org.json.JSONException: Expected a ',' or '}' at 20 [character 21 line 1]
      com.liferay.portal.kernel.json.JSONException: org.json.JSONException: Expected a ',' or '}' at 20 [character 21 line 1]
      at com.liferay.portal.json.JSONObjectImpl.<init>(JSONObjectImpl.java:79)
      at com.liferay.portal.json.JSONFactoryImpl.createJSONObject(JSONFactoryImpl.java:160)
      at com.liferay.portal.kernel.json.JSONFactoryUtil.createJSONObject(JSONFactoryUtil.java:68)

      Workaround:
      Create service wrapper for com.liferay.portlet.expando.service.ExpandoValueService and override the getJSONData method adding quotes to the value before constructing the json object of it.

        Attachments

          Activity

            People

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            mikko.torri@gmail.com Mikko Torri
            Participants of an Issue:
            Recent user:
            Esther Sanz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              5 years, 42 weeks, 1 day ago

                Packages

                Version Package