Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-8505

ChangeAllPropertiesWithCertainValueTask fails on multivalue properties

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 6.3.0, 6.2.26
    • 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

      1. Import the website.test (23).xml into website workspace. It contains a property named test with value this.is.a.test.property
      2. 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"))
        	    );
        	} 
      1. 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

          There are no Sub-Tasks for this issue.

              mstrucka Marek Strucka
              jayala Jonathan Ayala
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD