-
Bug
-
Resolution: Fixed
-
Neutral
-
6.2.21
-
None
-
None
Currently, delta task info.magnolia.module.delta.ChangeAllPropertiesWithCertainValueTask only works with single String values. It would be useful if this task also worked with multivalue properties. Instead, it throws an exception if there's a multivalued property and the execution is interrupted.
Steps to reproduce
- Import the website.test (23).xml into website workspace. It contains a property named test with value this.is.a.test.property
- Add an Install/update task to any module that makes use of ChangeAllPropertiesWithCertainValueTask. For example:
public CustomModuleVersionHandler() { register(DeltaBuilder.update("1.2", "Testing ChangeAllPropertiesWithCertainValueTask").addTask(new ChangeAllPropertiesWithCertainValueTask("website", "/", "this.is.a.test.property", "this.is.a.MODIFIED.test.property")) Â Â ); }
- Install/update the module
Expected results
Test property is modified during installation/update task
Actual results
There's an error and test property is not modified
ERROR info.magnolia.module.InstallContextImpl : [0/3 tasks - custom-module Magnolia Module (version 1.2.0)]> Could not install or update custom-module module. Task 'Change value of all properties with certain value.' failed. (ValueFormatException: property /test2/main/0/assignedSegments is a multi-valued property, so it's values can only be retrieved as an array) info.magnolia.module.delta.TaskExecutionException: Could not execute task: Value format: property /test2/main/0/assignedSegments is a multi-valued property, so it's values can only be retrieved as an array at info.magnolia.module.delta.AbstractRepositoryTask.execute(AbstractRepositoryTask.java:59) ~[magnolia-core-6.2.20.jar:?] at info.magnolia.module.ModuleManagerImpl.applyDeltas(ModuleManagerImpl.java:491) ~[magnolia-core-6.2.20.jar:?] at info.magnolia.module.ModuleManagerImpl.installOrUpdateModule(ModuleManagerImpl.java:473) ~[magnolia-core-6.2.20.jar:?] at info.magnolia.module.ModuleManagerImpl$1.doExec(ModuleManagerImpl.java:271) ~[magnolia-core-6.2.20.jar:?] at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:407) ~[magnolia-core-6.2.20.jar:?] at info.magnolia.context.MgnlContext$VoidOp.exec(MgnlContext.java:404) ~[magnolia-core-6.2.20.jar:?] at info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:378) ~[magnolia-core-6.2.20.jar:?] at info.magnolia.module.ModuleManagerImpl.performInstallOrUpdate(ModuleManagerImpl.java:265) ~[magnolia-core-6.2.20.jar:?] at info.magnolia.module.ui.ModuleManagerWebUI$2.run(ModuleManagerWebUI.java:126) ~[magnolia-core-6.2.20.jar:?] at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_121] Caused by: javax.jcr.ValueFormatException: property /test2/main/0/assignedSegments is a multi-valued property, so it's values can only be retrieved as an array at org.apache.jackrabbit.core.PropertyImpl.internalGetValue(PropertyImpl.java:483) ~[jackrabbit-core-2.20.4.jar:2.20.4] at org.apache.jackrabbit.core.PropertyImpl.getValue(PropertyImpl.java:510) ~[jackrabbit-core-2.20.4.jar:2.20.4] at org.apache.jackrabbit.core.PropertyImpl.getString(PropertyImpl.java:520) ~[jackrabbit-core-2.20.4.jar:2.20.4] at info.magnolia.module.delta.ChangeAllPropertiesWithCertainValueTask.doExecute(ChangeAllPropertiesWithCertainValueTask.java:106) ~[magnolia-core-6.2.20.jar:?] at info.magnolia.module.delta.AbstractRepositoryTask.execute(AbstractRepositoryTask.java:57) ~[magnolia-core-6.2.20.jar:?] ... 9 more
Development notes
The error occurs in line 129 of info.magnolia.module.delta.ChangeAllPropertiesWithCertainValueTask, where a conditional statement could be added in order to avoid the javax.jcr.ValueFormatException
if (property.getString().equals(currentValue)) {
Acceptance criteria
1.
|
Implementation | Completed | Marek Strucka | |
2.
|
Review | Completed | Milan Divilek | |
3.
|
PiQA | Completed | Milan Divilek | |
4.
|
QA | Completed | Jaroslav Simak |