Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-8032

Compatibility layer: Restore version throws null pointer

XMLWordPrintable

      The Restore version action throws a null pointer.

      Reproduce

      1. Using the compatibility Pages app create a version of any page (i.e. publish a page).
      2. Try and restore the version created

      Expected
      The version selected is restored.

      Actual
      A null pointer is thrown stacktrace-full.txt

      ERROR info.magnolia.ui.contentapp.browser.action.RestoreVersionAction 02.05.2023 13:22:36 -- Restoring of version failed. java.lang.NullPointerException
      javax.jcr.RepositoryException: java.lang.NullPointerException
      	at info.magnolia.ui.contentapp.browser.action.RestoreVersionAction.createVersionBeforeRestore(RestoreVersionAction.java:197) ~[magnolia-ui-framework-compatibility-6.2.33.jar:?]
      	at info.magnolia.ui.contentapp.browser.action.RestoreVersionAction.restoreVersion(RestoreVersionAction.java:222) ~[magnolia-ui-framework-compatibility-6.2.33.jar:?]
      	at info.magnolia.ui.contentapp.browser.action.RestoreVersionAction.access$800(RestoreVersionAction.java:75) ~[magnolia-ui-framework-compatibility-6.2.33.jar:?]
      	at info.magnolia.ui.contentapp.browser.action.RestoreVersionAction$1.onSuccess(RestoreVersionAction.java:143) [magnolia-ui-framework-compatibility-6.2.33.jar:?]
      	at info.magnolia.ui.dialog.formdialog.FormDialogPresenterImpl$1.onSuccess(FormDialogPresenterImpl.java:146) [magnolia-ui-framework-compatibility-6.2.33.jar:?]
      ...
      ...
      Caused by: java.lang.NullPointerException
      	at info.magnolia.context.RequestAttributeStrategy.setAttribute(RequestAttributeStrategy.java:165) ~[magnolia-core-6.2.33.jar:?]
      	at info.magnolia.context.AbstractContext.setAttribute(AbstractContext.java:114) ~[magnolia-core-6.2.33.jar:?]
      	at info.magnolia.commands.impl.VersionCommand.execute(VersionCommand.java:101) ~[magnolia-core-6.2.33.jar:?]
      	at info.magnolia.ui.contentapp.browser.action.RestoreVersionAction.createVersionBeforeRestore(RestoreVersionAction.java:195) ~[magnolia-ui-framework-compatibility-6.2.33.jar:?]
      	... 140 more
      

      Workaround
      Use the UI6 (aka new) Pages app to restore the version.

      Notes
      Looking closer the null pointer occurs on Line 195 of RestoreVersionAction where the versionCommand calls execute(). Line 101 of VersionCommand#execute() where setAttribute() is called ultimately throws the null because Line 165 of RequestAttributeStrategy#setAttribute() returns null from getRequest().

        Acceptance criteria

          1. null-pointer.png
            null-pointer.png
            1.07 MB
          2. restore-version.png
            restore-version.png
            228 kB
          3. stacktrace-full.txt
            17 kB

              jsarf Jaromir Sarf
              rgange Richard Gange
              Nucleus
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved:
                Work Started:

                  Bug DoR
                  Task DoD

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - Not Specified
                    Not Specified
                    Logged:
                    Time Spent - 3h
                    3h