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

org.json.JSONException: Null key logged at warning level

    Details

      Description

      If audit logging is turned on an unexpected warning with stacktrace is logged:

      2011-02-18 13:24:41,052 [WARN ] [liferay/audit] com.liferay.portal.json.JSONObjectImpl - org.json.JSONException: Null key.
      org.json.JSONException: Null key.
      at org.json.JSONObject.put(JSONObject.java:977)
      at com.liferay.portal.json.JSONObjectImpl.put(JSONObjectImpl.java:240)
      at com.liferay.portal.kernel.audit.AuditMessage.toJSONObject(AuditMessage.java:255)
      at com.liferay.portal.audit.service.impl.AuditEventLocalServiceImpl.addAuditEvent(AuditEventLocalServiceImpl.java:66)

      The cause of the issue is located in the AuditMessage.java code on line 255 (part of the method public JSONObject toJSONObject() )

      254 jsonObj.put(_CLIENT_IP, _clientIP);
      255 jsonObj.put(_clientHost, _clientHost);
      256 jsonObj.put(_MESSAGE, _message);

      The key passed in _clientHost is incorrect. The correct key should be _CLIENT_HOST

      This same code still exists in the current revision of the file: 69340, only on a different line
      portal/trunk/portal-service/src/com/liferay/portal/kernel/audit/AuditMessage.java

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  6 years, 43 weeks, 3 days ago

                  Packages

                  Version Package
                  6.0.X EE
                  6.1.2 CE GA3
                  6.1.30 EE GA3
                  6.2.0 CE M5