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

Cannot call a jsonws service from URL with null parameters

    Details

      Description

      Issue
      Cannot call a jsonws service from URL with null parameters

      Steps to reproduce

      1. Start a clean bundle
      2. Login
      3. Create a new user with:
        screenName, emailAddress, firstName, lastName
      4. Note the user ID
      5. Go to http://localhost:8080/api/jsonws
      6. Search for update-user and select the one with less parameters
      7. Input the following fields: userId, screenName, emailAddress, firstName, lastName
      8. Set passwordReset to false
      9. Set all int values to avoid error
        facebookId=0, prefixId=0, suffixId=0, birthdayMonth=0, birthdayDay=1, birthdayYear=1970
      10. Click Invoke
      11. Note that it completes successfully in Results tab
      12. Switch to URL Example tab
      13. Copy the URL and paste it in a different browser tab (add proper p_auth query parameter
        http://localhost:8080/api/jsonws/user/update-user/user-id/36079/-old-password/-new-password1/-new-password2/password-reset/false/-reminder-query-question/-reminder-query-answer/screen-name/user1/email-address/user1%40liferay.com/facebook-id/0/-open-id/-language-id/-time-zone-id/-greeting/-comments/first-name/First/-middle-name/last-name/Last/prefix-id/0/suffix-id/0/male/true/birthday-month/0/birthday-day/1/birthday-year/1970/-sms-sn/-facebook-sn/-jabber-sn/-skype-sn/-twitter-sn/-job-title/-group-ids/-organization-ids/-role-ids/-user-group-roles/-user-group-ids?p_auth=BKUAnMrX
        
      14. Note that we get a Null Pointer Exception error
        01:27:50,575 ERROR [http-nio-8080-exec-8][JSONWebServiceServiceAction:97] java.lang.NullPointerException
      15. Add a blank space (%20) to open-id, facebook-sn, jabber-sn, skype-sn and twitter-sn
        http://localhost:8080/api/jsonws/user/update-user/user-id/36079/-old-password/-new-password1/-new-password2/password-reset/false/-reminder-query-question/-reminder-query-answer/screen-name/user1/email-address/user1%40liferay.com/facebook-id/0/open-id/%20/-language-id/-time-zone-id/-greeting/-comments/first-name/First/-middle-name/last-name/Last/prefix-id/0/suffix-id/0/male/true/birthday-month/0/birthday-day/1/birthday-year/1970/-sms-sn/facebook-sn/%20/jabber-sn/%20/skype-sn/%20/twitter-sn/%20/-job-title/-group-ids/-organization-ids/-role-ids/-user-group-roles/-user-group-ids?p_auth=BKUAnMrX
        
      16. Note that it completes successfully

      Expected results
      Method can be called with optional parameters as null

      Actual results
      Setting optional fields as null results in NPE

      Reproduced in
      7.0.x (35f70f7688d7696839f35eee6f888e2f3070d1b0)
      master (3c2655a56ffdf033ae811a97f77362cafd954de9).

      Note
      Note that long/int values needed to be inputed in GUI to work, some of those seems to be optional and should not be required.
      (facebookId=0, prefixId=0, suffixId=0, birthdayMonth=0, birthdayDay=1, birthdayYear=1970)

        Attachments

          Activity

            People

            • Assignee:
              david.zhang David Zhang (Inactive)
              Reporter:
              david.zhang David Zhang (Inactive)
              Participants of an Issue:
              Recent user:
              Csaba Turcsan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 26 weeks, 5 days ago

                Packages

                Version Package
                7.0.0 DXP FP11
                7.0.0 DXP SP2
                7.0.3 CE GA4
                7.1.X
                Master