Uploaded image for project: 'Live Copy'
  1. Live Copy
  2. LIVECOPY-256

Exception in relink if content is not matching definition

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Neutral
    • 3.2.4
    • 3.2.2

    Description

      Steps to reproduce

      1.  Define a new component
        form:
          properties:
            link:
              label: Link
              $type: linkField
              chooser:
                workbenchChooser:
                  appName: pages
            image:
              $type: compositeField
              label: Image composite
              itemProvider:
                $type: jcrChildNodeProvider
              properties:
                title:
                  label: Image Title
                  $type: textField
        
      2. Create a master, create a page and add the component above.
      3. Create a livecopy from master
      4. Modify previous component adding a new composite field:
        form:
          properties:
            link:
              label: Link
              $type: linkField
              chooser:
                workbenchChooser:
                  appName: pages
            image:
              $type: compositeField
              label: Image composite
              itemProvider:
                $type: jcrChildNodeProvider
              properties:
                title:
                  label: Image Title
                  $type: textField
            secondaryImage:
              $type: compositeField
              label: Secondary Image composite
              itemProvider:
                $type: jcrChildNodeProvider
              properties:
                title:
                  label: Secondary Image Title
                  $type: textField
        
      5. Try to relink the livecopy

      Expected results

      Links are relinked and no exceptions are thrown

      Actual results

      Exception:

      Caused by: java.lang.RuntimeException: javax.jcr.PathNotFoundException: secondaryImage
      	at info.magnolia.livecopy.actions.RewirePageLinksAction.onSuccess(RewirePageLinksAction.java:118) ~[magnolia-livecopy-3.2.2.jar:?]
      	at info.magnolia.livecopy.actions.RewirePageLinksAction.lambda$process$0(RewirePageLinksAction.java:92) ~[magnolia-livecopy-3.2.2.jar:?]
      	at java.util.Optional.ifPresent(Unknown Source) ~[?:?]
      	at info.magnolia.ui.AlertBuilder.lambda$build$ccff1191$1(AlertBuilder.java:182) ~[magnolia-ui-framework-6.2.6.jar:?]
      	at jdk.internal.reflect.GeneratedMethodAccessor511.invoke(Unknown Source) ~[?:?]
      	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
      	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
      	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:499) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:273) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:237) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1014) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at com.vaadin.ui.Button.fireClick(Button.java:384) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at com.vaadin.ui.Button$1.click(Button.java:57) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at jdk.internal.reflect.GeneratedMethodAccessor510.invoke(Unknown Source) ~[?:?]
      	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
      	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
      	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:155) ~[vaadin-server-8.9.4.jar:8.9.4]
      	... 109 more
      Caused by: javax.jcr.PathNotFoundException: secondaryImage
      	at org.apache.jackrabbit.core.NodeImpl$8.perform(NodeImpl.java:2167) ~[jackrabbit-core-2.20.0.jar:2.20.0]
      	at org.apache.jackrabbit.core.NodeImpl$8.perform(NodeImpl.java:2161) ~[jackrabbit-core-2.20.0.jar:2.20.0]
      	at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216) ~[jackrabbit-core-2.20.0.jar:2.20.0]
      	at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91) ~[jackrabbit-core-2.20.0.jar:2.20.0]
      	at org.apache.jackrabbit.core.NodeImpl.getNode(NodeImpl.java:2161) ~[jackrabbit-core-2.20.0.jar:2.20.0]
      	at info.magnolia.jcr.wrapper.DelegateNodeWrapper.getNode(DelegateNodeWrapper.java:204) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.getNode(ContentDecoratorNodeWrapper.java:151) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.wrapper.DelegateNodeWrapper.getNode(DelegateNodeWrapper.java:204) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.getNode(ContentDecoratorNodeWrapper.java:151) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.wrapper.DelegateNodeWrapper.getNode(DelegateNodeWrapper.java:204) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.getNode(ContentDecoratorNodeWrapper.java:151) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.wrapper.DelegateNodeWrapper.getNode(DelegateNodeWrapper.java:204) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.getNode(ContentDecoratorNodeWrapper.java:151) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.wrapper.DelegateNodeWrapper.getNode(DelegateNodeWrapper.java:204) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.getNode(ContentDecoratorNodeWrapper.java:151) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.wrapper.DelegateNodeWrapper.getNode(DelegateNodeWrapper.java:204) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.getNode(ContentDecoratorNodeWrapper.java:151) ~[magnolia-core-6.2.6.jar:?]
      	at info.magnolia.livecopy.actions.rewire.StandardRewirePageLinksHelper.handleCompositeField(StandardRewirePageLinksHelper.java:119) ~[magnolia-livecopy-3.2.2.jar:?]
      	at info.magnolia.livecopy.actions.rewire.StandardRewirePageLinksHelper.rewriteLinksForField(StandardRewirePageLinksHelper.java:94) ~[magnolia-livecopy-3.2.2.jar:?]
      	at info.magnolia.livecopy.actions.rewire.StandardRewirePageLinksHelper.rewriteLinksForNode(StandardRewirePageLinksHelper.java:81) ~[magnolia-livecopy-3.2.2.jar:?]
      	at info.magnolia.livecopy.actions.rewire.RewirePageLinksHelper.rewritePageLinks(RewirePageLinksHelper.java:63) ~[magnolia-livecopy-3.2.2.jar:?]
      	at info.magnolia.livecopy.actions.RewirePageLinksAction.onSuccess(RewirePageLinksAction.java:105) ~[magnolia-livecopy-3.2.2.jar:?]
      	at info.magnolia.livecopy.actions.RewirePageLinksAction.lambda$process$0(RewirePageLinksAction.java:92) ~[magnolia-livecopy-3.2.2.jar:?]
      	at java.util.Optional.ifPresent(Unknown Source) ~[?:?]
      	at info.magnolia.ui.AlertBuilder.lambda$build$ccff1191$1(AlertBuilder.java:182) ~[magnolia-ui-framework-6.2.6.jar:?]
      	at jdk.internal.reflect.GeneratedMethodAccessor511.invoke(Unknown Source) ~[?:?]
      	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
      	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
      	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:499) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:273) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:237) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1014) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at com.vaadin.ui.Button.fireClick(Button.java:384) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at com.vaadin.ui.Button$1.click(Button.java:57) ~[vaadin-server-8.9.4.jar:8.9.4]
      	at jdk.internal.reflect.GeneratedMethodAccessor510.invoke(Unknown Source) ~[?:?]
      	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
      	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
      	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:155) ~[vaadin-server-8.9.4.jar:8.9.4]
      	... 109 more
      

      Workaround

      Open the original component and save it and push changes, so that the new empty node is added.

      Development notes

      When relinking composite fields, the definition of the field is taken into account:

      private void handleCompositeField(Node slaveContentNode, CompositeFieldDefinition compositeFieldDef, Locale locale, boolean protectFieldAfterRewire) throws Exception {
              List<EditorPropertyDefinition> fields = compositeFieldDef.getProperties();
              Node compositeNode = slaveContentNode.getNode(compositeFieldDef.getName());
              for (EditorPropertyDefinition configuredFieldDefinition : fields) {
                  rewriteLinksForField(compositeNode, configuredFieldDefinition, locale, protectFieldAfterRewire);
              }
          }
      

      In case of missing node instead of failing, the exception should be ignored instead of failing.
      We should check behaviour for Multifields also.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              efochr Evzen Fochr
              miruela Mercedes Iruela
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD

                  Jenkins

                    No builds found.