Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
7.0.0 DXP SP2, Master
-
7.0.x
-
Committed
-
4
Description
Issue
Cannot call a jsonws service from URL with null parameters
Steps to reproduce
- Start a clean bundle
- Login
- Create a new user with:
screenName, emailAddress, firstName, lastName - Note the user ID
- Go to http://localhost:8080/api/jsonws
- Search for update-user and select the one with less parameters
- Input the following fields: userId, screenName, emailAddress, firstName, lastName
- Set passwordReset to false
- Set all int values to avoid error
facebookId=0, prefixId=0, suffixId=0, birthdayMonth=0, birthdayDay=1, birthdayYear=1970 - Click Invoke
- Note that it completes successfully in Results tab
- Switch to URL Example tab
- 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
- Note that we get a Null Pointer Exception error
01:27:50,575 ERROR [http-nio-8080-exec-8][JSONWebServiceServiceAction:97] java.lang.NullPointerException
- 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
- 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)