Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-38951

Inline Comments Missing After Space Export/Import Process

    XMLWordPrintable

Details

    Description

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

      Summary

      In-line Comments and Resolved Comments are imported with a Space Export, but throw a 500 error when the REST call is made for rendering the Page. This has been replicated with space exports from Confluence Cloud and Confluence Server.

      Environment

      • Confluence Cloud
      • Confluence Server 5.7, 5.8.18 or 5.9.4.
      • The Space has Resolved in-line comments

      Steps to Reproduce

      1. Go to a Space and a Page within that Space. Add two in-line comments and resolve one of them.
      2. Do a full XML export of the Space
      3. Import the Space export into a new instance (either same version or same major version)
      4. Notice the import completes successfully, but the in-line and resolved comments are not displayed even though they are present in the entities.xml file and database.

      Expected Results

      In-line comments are displayed.

      Actual Results

      The in-line comments are imported into the database, however the user_key is not mapped correctly from the old instance to the new instance.

      Workaround

      SQL manipulation in the database is not supported. Please make sure you have a database backup.

      1. Shutdown Confluence
      2. Run this query
        select stringval from contentproperties where propertyname = 'status-lastmodifier' and stringval not in (select user_key from user_mapping) group by stringval;
        
      3. Run this code to update the resolved comment's user to the correct user_key
        update contentproperties set stringval = (select user_key from user_mapping where username = '<username>') where stringval = '<old user_key>';
        

        Where

        • <username> is the username of the User who originally resolved the in-line comment.
        • <old user_key> is the value identified from the first SQL query.
      4. Restart Confluence

      In-line comments should now display

      Analysis

      In-line comments are generated by a REST call

      And this returns a 500, which in the logs is

      atlassian-confluence.log
      2016-04-14 10:44:11,224 ERROR [http-nio-8090-exec-8] [common.error.jersey.ThrowableExceptionMapper] toResponse Uncaught exception thrown by REST service: null
       -- url: /rest/inlinecomments/1.0/comments | userName: jrichards
      java.lang.NullPointerException
      	at com.atlassian.confluence.plugins.inlinecomments.helper.InlineCommentUserHelper.getFullNameForUserKey(InlineCommentUserHelper.java:31)
      	at com.atlassian.confluence.plugins.inlinecomments.entities.InlineCommentBuilder.buildResolveData(InlineCommentBuilder.java:54)
      	at com.atlassian.confluence.plugins.inlinecomments.entities.InlineCommentBuilder.convertCommentToInlineComment(InlineCommentBuilder.java:111)
      	at com.atlassian.confluence.plugins.inlinecomments.entities.InlineCommentBuilder.build(InlineCommentBuilder.java:84)
      	at com.atlassian.confluence.plugins.inlinecomments.service.InlineCommentServiceImpl.getCommentThreads(InlineCommentServiceImpl.java:255)
      	at com.atlassian.confluence.plugins.inlinecomments.resources.InlineCommentResource.getInlineComments(InlineCommentResource.java:82)
      	at sun.reflect.GeneratedMethodAccessor1269.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      

      Here's the code

      InlineCommentUserHelper.java
         public String getFullNameForUserKey(String userKey)
          {
              if (StringUtils.isNotEmpty(userKey))
              {
                  return userAccessor.getUserByKey(new UserKey(userKey)).getFullName();
              }
      
              return i18nBeanFactory.getI18NBean(getUserLocale()).getText(ANONYMOUS_KEY);
          }
      

      In the Space export XML, the in-line comment is associated with the user_key but if the user is not in the new Confluence, or if they do exist but don't have that same user_key then there's no Full name.

      1. The above code needs to be more robust for checking nulls
      2. The import needs to map in-line comments to username the same way Page ownership and other items are mapped

      Attachments

        Issue Links

          Activity

            People

              pwallach Phil Wallach
              ajean Andy J.
              Votes:
              10 Vote for this issue
              Watchers:
              25 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: