Content must not be null error thrown for missing attachment

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low
    • None
    • Affects Version/s: 6.8.3
    • Component/s: Content - Attachments
    • None
    • 8
    • Severity 3 - Minor
    • 1

      Issue Summary

      Navigating to a URL of a non-existent attachment leads to a stack track in the browser, as follows:

      Cause
      java.lang.IllegalArgumentException: Content must not be null
          at org.springframework.util.Assert.notNull(Assert.java:115)
      
      Stack Trace:[hide]
      java.lang.IllegalArgumentException: Content must not be null
      	at org.springframework.util.Assert.notNull(Assert.java:115)
      	at com.atlassian.confluence.pages.attachments.CachingAttachmentDao.getLatestAttachment(CachingAttachmentDao.java:69)
      	at com.atlassian.confluence.pages.DefaultAttachmentManager.getAttachment(DefaultAttachmentManager.java:143)
      	at com.atlassian.confluence.pages.DefaultAttachmentManager.getAttachment(DefaultAttachmentManager.java:109)
      	at com.atlassian.confluence.pages.DelegatorAttachmentManager.getAttachment(DelegatorAttachmentManager.java:104)
      	at com.atlassian.confluence.pages.CachingAttachmentManager.getAttachment(CachingAttachmentManager.java:175)
      	at sun.reflect.GeneratedMethodAccessor833.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
      

      Steps to Reproduce

      1. Navigate to a page in Confluence where an attachment doesn't exist. For example: https://confluence.atlassian.com/download/attachments/189015999/not_exist.jpg.

      Expected Results

      An error message like 'This attachment doesn't exist or you don't have permissions to view it' is displayed, vs. an unreadable stack trace.

      Actual Results

      The below exception is thrown in the browser and in the logs:

      Cause
      java.lang.IllegalArgumentException: Content must not be null
          at org.springframework.util.Assert.notNull(Assert.java:115)
      
      Stack Trace:[hide]
      java.lang.IllegalArgumentException: Content must not be null
      	at org.springframework.util.Assert.notNull(Assert.java:115)
      	at com.atlassian.confluence.pages.attachments.CachingAttachmentDao.getLatestAttachment(CachingAttachmentDao.java:69)
      	at com.atlassian.confluence.pages.DefaultAttachmentManager.getAttachment(DefaultAttachmentManager.java:143)
      	at com.atlassian.confluence.pages.DefaultAttachmentManager.getAttachment(DefaultAttachmentManager.java:109)
      	at com.atlassian.confluence.pages.DelegatorAttachmentManager.getAttachment(DelegatorAttachmentManager.java:104)
      	at com.atlassian.confluence.pages.CachingAttachmentManager.getAttachment(CachingAttachmentManager.java:175)
      	at sun.reflect.GeneratedMethodAccessor833.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      

       
      See screen shot: https://cl.ly/663b43cc4e8c

      Workaround

      None

            Assignee:
            Unassigned
            Reporter:
            J van Leeuwen
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: