Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-39517

Space Imports with SpaceName the same as SpaceKey cause Template NullPointerException

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      Summary

      If a user imports a space where the Spacename is exactly the same as the SpaceKey (eg: WOW / WOW) then once the import is complete a Template error is shown on all pages in Confluence

      Steps to Reproduce

      1. Create a Space with the following name and key: name: WOW key: WOW
        • Make sure they are both in full capital letters
      2. Create a full Space Export
      3. Import this Space into a different instance

      Expected Results

      Once the import is complete the user should be taken to the Space

      Actual Results

      Each Confluence page now shows the following error:

      Error occurred during template rendering: Invocation of method 'getRenderedParam' in class
      com.atlassian.plugin.web.model.DefaultWebParam threw exception java.lang.NullPointerException at
      template/includes/menu-macros.vm[line 67, column 50]. Contact your administrator for assistance.
      

      The below exception is thrown in the Confluence log file:

      @4000000056164e301e5c4144 org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getRenderedParam' in  class com.atlassian.plugin.web.model.DefaultWebParam threw exception java.lang.NullPointerException at template/includes/menu-macros.vm[line 67, column 50]
      @4000000056164e301e5c9b1c       at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
      @4000000056164e301e5c9b1c       at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284)
      @4000000056164e301e5ca2ec       at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
      @4000000056164e301e5ca6d4       at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:507)
      @4000000056164e301e5ca6d4       at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
      @4000000056164e301e5cb674       at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
      @4000000056164e301e5cb674       at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      @4000000056164e301e5cba5c       at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
      @4000000056164e301e5cba5c       at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      @4000000056164e301e5cc22c       at org.apache.velocity.runtime.directive.Foreach.performIteration(Foreach.java:393)
      @4000000056164e301e5cc22c       at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:316)
      @4000000056164e301e5cc614       at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
      ...
      @4000000056164e301e608aec Caused by: java.lang.NullPointerException
      @4000000056164e301e608aec       at com.atlassian.confluence.plugins.createcontent.impl.DefaultSpaceCollectionService$1.compare(DefaultSpaceCollectionService.java:120)
      @4000000056164e301e6092bc       at com.atlassian.confluence.plugins.createcontent.impl.DefaultSpaceCollectionService$1.compare(DefaultSpaceCollectionService.java:116)
      @4000000056164e301e6096a4       at java.util.TimSort.countRunAndMakeAscending(TimSort.java:351)
      @4000000056164e301e6096a4       at java.util.TimSort.sort(TimSort.java:216)
      @4000000056164e301e6096a4       at java.util.Arrays.sort(Arrays.java:1512)
      @4000000056164e301e609e74       at java.util.ArrayList.sort(ArrayList.java:1454)
      @4000000056164e301e609e74       at java.util.Collections.sort(Collections.java:175)
      @4000000056164e301e60a25c       at com.atlassian.confluence.plugins.createcontent.impl.DefaultSpaceCollectionService.getOtherSpaces(DefaultSpaceCollectionService.java:115)
      @4000000056164e301e60a25c       at com.atlassian.confluence.plugins.createcontent.impl.DefaultSpaceCollectionService.getSpaces(DefaultSpaceCollectionService.java:69)
      @4000000056164e301e60aa2c       at com.atlassian.confluence.plugins.createcontent.contextproviders.QuickCreateUrlContextProvider.getContextMap(QuickCreateUrlContextProvider.java:65)
      @4000000056164e301e60c96c       at com.atlassian.plugin.web.model.AbstractWebItem.getContextMap(AbstractWebItem.java:30)
      @4000000056164e301e60c96c       at com.atlassian.plugin.web.model.DefaultWebParam.getRenderedParam(DefaultWebParam.java:48)
      

      Workaround

      To set a name to the space that is now showing as "undefined"

      Workaround 1:

      1. Go to Space > Space Directory: <confluence-site>/spacedirectory/view.action
      2. Look for spaces with the name set as 'undefined';
      3. Click the space name to go to the space
      4. Select: Space Tools -> Overview
      5. Edit Space Details to set a Name

      Workaround 2: If it's not possible to navigate to set a space name.

      1. Run the following command against the database
        select * from spaces where spacename is NULL;
        
      2. Stop Confluence
      3. Backup Confluence database
      4. In the database, run:
        update spaces set spacename='SPACE_NAME' where spaceid=XXXXXX;

        Where XXXXXX is the spaceid from the results returned in your Diagnosis, and the SPACE_NAME is set to the desired space name.

      5. Start Confluence
      6. Re-index Confluence

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              imaduro Ivan Maduro (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: