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

Misleading syntax error message testing push notifications

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 7.0.X, 7.1.X, 7.2.X, Master
    • Fix Version/s: None
    • Component/s: Push Notifications
    • Labels:
      None

      Description

      Reproducing steps

      1. Install Liferay Push if not already installed.
      2. Go to Control Panel > Configuration > System Settings and search for Firebase Push Notifications Sender.
      3. Input a random string in the field API Key (this should be an invalid key on purpose) and click on Update.
      4. Register a device for a user using Liferay method
        com.liferay.push.notifications.service.PushNotificationsDeviceLocalServiceUtil.addPushNotificationsDevice(userId, "firebase", token)
        

        where userId corresponds to the id of an actual user, and token can be any string.

      5. Go to Control Panel > Configuration > Push Notifications > Devices and check that the device has been registered.
      6. Click on the tab Test and input {} in the field Message (it just needs to be a valid json).
      7. Click on Send.
        Observed: The following syntax error message appears onscreen
        com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
        

        and in the log

        2019-09-26 11:02:46.038 ERROR [liferay/push_notification_response-1][PushNotificationsResponseMessageListener:41] {"payload":null,"javaClass":"com.liferay.push.notifications.sender.BaseResponse","id":null,"platform":"firebase","status":"java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $","succeeded":false,"token":null}
        2019-09-26 11:02:46.039 ERROR [http-nio-9090-exec-6][JSONWebServiceServiceAction:97] com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
        

        Expected: The error message should not be about syntax, since it is correct, but about the actual cause (incorrect API Key, configuration, connection, etc).

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              ricardo.couso Ricardo Couso
              Participants of an Issue:
              Recent user:
              Ricardo Couso
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                11 weeks, 1 day ago

                Packages

                Version Package