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

Exception in show versions when there is a LinkField to another workspace: Sub-app detail failed to start

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 5.4.16, 5.5.10, 5.6.5
    • 5.4.11, 5.5.4, 5.6
    • None
    • None
    • Kromeriz 140, Basel 143
    • 5

      Due to an issue reported on https://jira.magnolia-cms.com/browse/SUPPORT-7609 I have been testing linkField behaviour when using different workspaces from content apps and came across with this problem that could be reproduced in Tours app.

      Steps to reproduce:

      1. In Tours app create a new tour, assign category and image and save.
      2. Modify it and publish to create some versions
      3. Restart server*
      4. Access Tours app and check some version of the created in the previous step. You will get Sub-app detail failed to start

      *It is important to restart the server and do not access to the detail of the created tour before trying to see some version.

      What I've found when debugging their app is that when detail is accessed, an object of info.magnolia.ui.form.field.converter.BaseIdentifierToPathConverter is used but when version is accessed, there is a Mutable wrapper of info.magnolia.ui.form.field.converter.BaseIdentifierToPathConverter@59d6ba51 with modified properties: workspaceName : data

      It produces a NullPointerException when getting JCRSession in

      BaseIdentifierToPathConverter.java
      try {
                  Session session = MgnlContext.getJCRSession(workspace);
                  res = session.getNode(path).getIdentifier();
              } catch (RepositoryException e) {
                  log.error("Unable to convert Path to UUID", e);
              }
      

      due to workspace property has not been set properly (it has null value) in

      LinkField.java
      public LinkField(LinkFieldDefinition linkFieldDefinition, ComponentProvider componentProvider) {
              this.definition = linkFieldDefinition;
              this.converter = definition.getIdentifierToPathConverter();
              if (this.converter != null) {
                  this.converter.setWorkspaceName(definition.getTargetWorkspace());
              }
              this.componentProvider = componentProvider;
              setIm
      

      What I found interesting is that it only happens if you haven't access to edit/detail before open version details. If you are experiencing the issue and you open the detail of the node, you will be able then to view version details. Somehow workspace property in BaseIdentifierToPathConverter.java is stored and used in the mutable wrapper after accessing edit/detail.

      Another things that could matter is that the reporter of the issue said it worked in 5.4.7 but not in 5.4.11 (and probably in higher than 5.4.7) and also that the name of the property workspace is different from workspaceName which is how the setter is called as well as the property in the configuration (JCR or Yaml).

      If you need more detailed information don't hesitate in asking me.

      Regards.

        Acceptance criteria

              mtrcek Matjaz Trcek
              jayala Jonathan Ayala
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD