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

Content must not be null error thrown for missing attachment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 6.8.3
    • Content - Attachments
    • None

      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

              Unassigned Unassigned
              jbennett@atlassian.com J van Leeuwen
              Votes:
              5 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: