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

Stack Trace Generated When Trying to View Drafts linked to a non existent Space

    XMLWordPrintable

Details

    Description

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

      Summary

      When a user has drafts connected to non-existing spaces, they will get a stracktrace when viewing their Drafts.

      This is sometimes the results of this bug:
      https://jira.atlassian.com/browse/CONF-41150

      Steps to Reproduce

      1. With a user, create a draft
      2. In some situations, the space it was created in may be deleted, but not the draft.
      3. Click 'Profile >> Drafts'

      Expected Results

      The user can still access their drafts.

      Actual Results

      An error page is shown with this stacktrace

      2016-04-01 13:09:09.751027500 org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getResumableDraftsBySpace' in  class com.atlassian.confluence.user.actions.ViewMyDraftsAction threw exception java.lang.NullPointerException: element cannot be mapped to a null key at /users/viewmydrafts.vm[line 118, column 30]
      2016-04-01 13:09:09.751040500 	at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223)
      2016-04-01 13:09:09.751041500 	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
      2016-04-01 13:09:09.751044500 	at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTReference.java:470)
      2016-04-01 13:09:09.751045500 	at org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExpression.java:62)
      2016-04-01 13:09:09.751045500 	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:85)
      2016-04-01 13:09:09.751051500 	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      2016-04-01 13:09:09.751052500 	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
      2016-04-01 13:09:09.751052500 	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      2016-04-01 13:09:09.751053500 	at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.getRenderedTagBody(ApplyDecoratorDirective.java:181)
      2016-04-01 13:09:09.751057500 	at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:155)
      2016-04-01 13:09:09.751058500 	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
      
      2016-04-01 13:09:09.751750500 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2016-04-01 13:09:09.751751500 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      2016-04-01 13:09:09.751751500 	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      2016-04-01 13:09:09.751754500 	at java.lang.Thread.run(Thread.java:745)
      2016-04-01 13:09:09.751755500 Caused by: java.lang.NullPointerException: element cannot be mapped to a null key
      2016-04-01 13:09:09.751755500 	at java.util.Objects.requireNonNull(Objects.java:228)
      2016-04-01 13:09:09.751756500 	at java.util.stream.Collectors.lambda$groupingBy$176(Collectors.java:907)
      2016-04-01 13:09:09.751756500 	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
      2016-04-01 13:09:09.751760500 	at java.util.ArrayList.forEach(ArrayList.java:1249)
      2016-04-01 13:09:09.751760500 	at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:390)
      2016-04-01 13:09:09.751760500 	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
      2016-04-01 13:09:09.751761500 	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
      2016-04-01 13:09:09.751761500 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
      2016-04-01 13:09:09.751766500 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      2016-04-01 13:09:09.751767500 	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      2016-04-01 13:09:09.751768500 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      2016-04-01 13:09:09.751768500 	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      2016-04-01 13:09:09.751772500 	at com.atlassian.confluence.user.actions.ViewMyDraftsAction.filterAndGroupDrafts(ViewMyDraftsAction.java:107)
      2016-04-01 13:09:09.751773500 	at com.atlassian.confluence.user.actions.ViewMyDraftsAction.getResumableDraftsBySpace(ViewMyDraftsAction.java:88)
      2016-04-01 13:09:09.751773500 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2016-04-01 13:09:09.751774500 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      2016-04-01 13:09:09.751774500 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      2016-04-01 13:09:09.751778500 	at java.lang.reflect.Method.invoke(Method.java:497)
      2016-04-01 13:09:09.751778500 	at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:142)
      2016-04-01 13:09:09.751779500 	at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:529)
      2016-04-01 13:09:09.751799500 	at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198)
      2016-04-01 13:09:09.751799500 	... 388 more
      

      Notes

      If you want to check only the affected users first, you can use this:

      select distinct um.username as "creator" from content c join user_mapping um on c.creator = um.user_key where c.contenttype = 'DRAFT' and c.draftspacekey not in (SELECT spacekey FROM SPACES) order by um.username;
      

      Workaround

      1. Find all drafts connected to non-existing spaces in the database:
        select c.contentid, c.title, c.draftspacekey, um.username as "creator" from content c join user_mapping um on c.creator = um.user_key where c.contenttype = 'DRAFT' and c.draftspacekey not in (SELECT spacekey FROM SPACES) order by c.creator;
        
      2. For every response, log in as the 'creator' and access this (won't work if you log in as any user other than the creator):
        https://instance.atlassian.net/wiki/json/deletedraft.action?draftId=<draft_id>&atl_token=#form_xsrfToken()
        
        • Replace the '<draft_id>' for the 'contentid'.
      3. If it works, that line should no longer appear in the select above and this should be shown in the page:
        {}
        

      Attachments

        Issue Links

          Activity

            People

              xtaixe Xavier Sanchez
              xtaixe Xavier Sanchez
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: