Details
-
Bug
-
Resolution: Fixed
-
Major
-
17.9.0-rc-1
-
Unit
-
Unknown
-
N/A
-
N/A
-
Description
Steps to reproduce
- Have an XClass with a Password property, and an object of that class where the password is already set
- Call $obj.set('password', '********') (e.g. the placeholder value sent back by a form displaying the password field in edit mode)
Expected
The existing password value is kept, as it was before 17.9.0RC1.
Actual
java.lang.NullPointerException: Cannot invoke "com.xpn.xwiki.objects.BaseProperty.getValue()" because "newProp" is null at com.xpn.xwiki.objects.BaseObject.set(BaseObject.java:522) at com.xpn.xwiki.api.Object.set(Object.java:206)
Analysis
PasswordClass#fromString deliberately returns null when given the form password placeholder, so that the stored password is not replaced by it. Before XWIKI-21417, BaseObject#set assigned the result of fromString to the property and skipped it when null, so the existing value was kept. Since XWIKI-21417, BaseObject#set updates the existing property in place with prop.setValue(newProp.getValue()), without checking whether newProp is null.
The null returned by fromString should be handled as "keep the current value".
This breaks for example the JIRA Macro basic auth configuration as soon as a second entry is saved: JIRA-126.
Attachments
Issue Links
- is caused by
-
XWIKI-21417 BaseObject#set always set the metadata dirty flag of the owner doc to true
-
- Closed
-
- is related to
-
JIRA-126 Saving basic auth config don't work on XWiki 18.4
-
- Open
-