java.lang.NullPointerException

Atlassian JIRA | Andy Jean [Atlassian] | 1 year ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    h3. 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. h3. Environment * Confluence Cloud * Confluence Server 5.7, 5.8.18 or 5.9.4. * The Space has Resolved in-line comments h3. Steps to Reproduce # Go to a Space and a Page within that Space. Add two in-line comments and resolve one of them. # Do a full XML export of the Space # Import the Space export into a new instance (either same version or same major version) # 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. h3. Expected Results In-line comments are displayed. h3. 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. h3. Workaround {color:red}SQL manipulation in the database is not supported. Please make sure you have a database backup.{color} # Shutdown Confluence # Run this query {code:language=sql} select stringval from contentproperties where propertyname = 'status-lastmodifier' and stringval not in (select user_key from user_mapping) group by stringval; {code} # Run this code to update the resolved comment's user to the correct {{user_key}} {code:language=sql} update contentproperties set stringval = (select user_key from user_mapping where username = '<username>') where stringval = '<old user_key>'; {code} 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. # Restart Confluence In-line comments should now display h3. Analysis In-line comments are generated by a REST call * http://confluence.mycompany.com/rest/inlinecomments/1.0/comments?containerId=<pageid>&_=1460592565065 And this returns a 500, which in the logs is {code:title=atlassian-confluence.log|language=none} 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) {code} Here's the code {code:title=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); } {code} 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. # The above code needs to be more robust for checking nulls # The import needs to map in-line comments to username the same way Page ownership and other items are mapped

    Atlassian JIRA | 1 year ago | Andy Jean [Atlassian]
    java.lang.NullPointerException
  2. 0

    h3. 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. h3. Environment * Confluence Cloud * Confluence Server 5.7, 5.8.18 or 5.9.4. * The Space has Resolved in-line comments h3. Steps to Reproduce # Go to a Space and a Page within that Space. Add two in-line comments and resolve one of them. # Do a full XML export of the Space # Import the Space export into a new instance (either same version or same major version) # 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. h3. Expected Results In-line comments are displayed. h3. 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. h3. Workaround {color:red}SQL manipulation in the database is not supported. Please make sure you have a database backup.{color} # Shutdown Confluence # Run this query {code:language=sql} select stringval from contentproperties where propertyname = 'status-lastmodifier' and stringval not in (select user_key from user_mapping) group by stringval; {code} # Run this code to update the resolved comment's user to the correct {{user_key}} {code:language=sql} update contentproperties set stringval = (select user_key from user_mapping where username = '<username>') where stringval = '<old user_key>'; {code} 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. # Restart Confluence In-line comments should now display h3. Analysis In-line comments are generated by a REST call * http://confluence.mycompany.com/rest/inlinecomments/1.0/comments?containerId=<pageid>&_=1460592565065 And this returns a 500, which in the logs is {code:title=atlassian-confluence.log|language=none} 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) {code} Here's the code {code:title=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); } {code} 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. # The above code needs to be more robust for checking nulls # The import needs to map in-line comments to username the same way Page ownership and other items are mapped

    Atlassian JIRA | 1 year ago | Andy Jean [Atlassian]
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at com.atlassian.confluence.plugins.inlinecomments.helper.InlineCommentUserHelper.getFullNameForUserKey()
    2. com.atlassian.confluence
      InlineCommentResource.getInlineComments
      1. com.atlassian.confluence.plugins.inlinecomments.helper.InlineCommentUserHelper.getFullNameForUserKey(InlineCommentUserHelper.java:31)
      2. com.atlassian.confluence.plugins.inlinecomments.entities.InlineCommentBuilder.buildResolveData(InlineCommentBuilder.java:54)
      3. com.atlassian.confluence.plugins.inlinecomments.entities.InlineCommentBuilder.convertCommentToInlineComment(InlineCommentBuilder.java:111)
      4. com.atlassian.confluence.plugins.inlinecomments.entities.InlineCommentBuilder.build(InlineCommentBuilder.java:84)
      5. com.atlassian.confluence.plugins.inlinecomments.service.InlineCommentServiceImpl.getCommentThreads(InlineCommentServiceImpl.java:255)
      6. com.atlassian.confluence.plugins.inlinecomments.resources.InlineCommentResource.getInlineComments(InlineCommentResource.java:82)
      6 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor1269.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      3. java.lang.reflect.Method.invoke(Method.java:497)
      3 frames