-
Bug
-
Resolution: Unresolved
-
Neutral
-
None
-
None
-
None
-
None
Steps to reproduce
PropertyUtil.setProperty(node, name, Arrays.asList(Calendar.getInstance().getTime(), null));
Expected results
assertThat(node, hasProperty("multiValue", new Object[]{null, date}));
passes
Actual results
The assertion fails.
Workaround
Create the value manually like this:
var valueFactory = node.getSession().getValueFactory(); node.setProperty(name, ((List<?>) value).stream() .map(Exceptions.wrap().function(o -> o == null ? null : PropertyUtil.createValue(o, valueFactory))) .toArray(Value[]::new) );
Development notes
- PropertUtils points to https://git.magnolia-cms.com/projects/PLATFORM/repos/main.pub/browse/magnolia-core/src/main/java/info/magnolia/jcr/util/PropertyUtil.java#140
- And that to https://git.magnolia-cms.com/projects/PLATFORM/repos/main.pub/browse/magnolia-core/src/main/java/info/magnolia/jcr/util/PropertyUtil.java#347 Here one would expect to not fallback to empty String but just return null as JCR Value
- When this is fixed, assertion fails on NPE in PropertyUtil.getValue which might be fixed as well as part of this ticket
Acceptance criteria
- is depended upon by
-
MGNLUI-7624 New multiValueField doesn't support null values
- Open
- is related to
-
MGNLUI-7601 Fields (except for the textField) inside of new multiValueField don't work
- Closed