java.lang.NullPointerException

Atlassian JIRA | Partha Kamal [Atlassian] | 7 years 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

    When testing an upgrade, customer was getting NPE being thrown on the dashboard, with the following stack traces as the cause: {noformat} 2010-03-24 19:26:58,469 ERROR [http-9823-1] [atlassian.confluence.pages.DefaultAttachmentManager] getAttachmentData Could not find data for attachment: Attachment: Options.GIF v.1 (92241928) nwilkins - java.io.FileNotFoundException: /home/user/confluence/data/attachments/ver003/177/12/262177/134/78/92078134/92241928 (No such file or directory) ... 2010-03-24 19:26:58,473 ERROR [http-9823-1] [renderer.v2.components.MacroRendererComponent] processMacro Unexpected error formatting macro: recently-updated-dashboard -- referer: http://HOST:PORT/admin/search-indexes.action | url: /dashboard.action | userName: admin | action: dashboard java.lang.NullPointerException at com.atlassian.core.util.ImageInfo.read(ImageInfo.java:1228) at com.atlassian.core.util.ImageInfo.check(ImageInfo.java:249) at com.atlassian.confluence.pages.attachments.DefaultImageDetailsManager.buildImageDetails(DefaultImageDetailsManager.java:87) at com.atlassian.confluence.pages.attachments.DefaultImageDetailsManager.createImageDetails(DefaultImageDetailsManager.java:56) at com.atlassian.confluence.pages.attachments.DefaultImageDetailsManager.getImageDetails(DefaultImageDetailsManager.java:48) at com.atlassian.confluence.pages.thumbnail.DefaultThumbnailManager.getThumbnailInfo(DefaultThumbnailManager.java:132) at com.atlassian.confluence.pages.thumbnail.DefaultThumbnailManager.getThumbnailInfo(DefaultThumbnailManager.java:127) at com.atlassian.confluence.util.DefaultThumbnailInfoFactory.getThumbnailInfo(DefaultThumbnailInfoFactory.java:22) at com.atlassian.confluence.plugins.macros.dashboard.RecentlyUpdatedContentMacro.addThumbnailData(RecentlyUpdatedContentMacro.java:406) at com.atlassian.confluence.plugins.macros.dashboard.RecentlyUpdatedContentMacro.getChangeSets(RecentlyUpdatedContentMacro.java:357) at com.atlassian.confluence.plugins.macros.dashboard.RecentlyUpdatedContentMacro.execute(RecentlyUpdatedContentMacro.java:303) at com.atlassian.confluence.macro.ContentFilteringMacro.execute(ContentFilteringMacro.java:106) at com.atlassian.renderer.v2.macro.ResourceAwareMacroDecorator.execute(ResourceAwareMacroDecorator.java:51) at com.atlassian.renderer.v2.components.MacroRendererComponent.executeMacro(MacroRendererComponent.java:188) at com.atlassian.renderer.v2.components.MacroRendererComponent.processMacro(MacroRendererComponent.java:154) at com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:58) at com.atlassian.renderer.v2.components.WikiContentRendererHandler.handleMacro(WikiContentRendererHandler.java:18) at com.atlassian.renderer.v2.WikiMarkupParser.makeMacro(WikiMarkupParser.java:120) at com.atlassian.renderer.v2.WikiMarkupParser.handlePotentialMacro(WikiMarkupParser.java:105) at com.atlassian.renderer.v2.WikiMarkupParser.parse(WikiMarkupParser.java:60) at com.atlassian.renderer.v2.components.MacroRendererComponent.render(MacroRendererComponent.java:43) at com.atlassian.renderer.v2.V2Renderer.render(V2Renderer.java:53) at com.atlassian.renderer.v2.plugin.PluggableV2Renderer.render(PluggableV2Renderer.java:30) at com.atlassian.renderer.v2.V2RendererFacade.convertWikiToXHtml(V2RendererFacade.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) ... {noformat} The NPE is being thrown because the DefaultAttachmentManager cannot find the attachment in the getAttachmentData(Attachment) method. This is most likely because when copying the {{<CONFLUENCE_HOME>}} and the database over from production to test on the test server, they were copied over from a live instance and are slightly out of sync, hence the attachment does not exist in the home directory though it does in the database. Point of the story is, we shouldn't be throwing NPEs :)

    Atlassian JIRA | 7 years ago | Partha Kamal [Atlassian]
    java.lang.NullPointerException
  2. 0

    When testing an upgrade, customer was getting NPE being thrown on the dashboard, with the following stack traces as the cause: {noformat} 2010-03-24 19:26:58,469 ERROR [http-9823-1] [atlassian.confluence.pages.DefaultAttachmentManager] getAttachmentData Could not find data for attachment: Attachment: Options.GIF v.1 (92241928) nwilkins - java.io.FileNotFoundException: /home/user/confluence/data/attachments/ver003/177/12/262177/134/78/92078134/92241928 (No such file or directory) ... 2010-03-24 19:26:58,473 ERROR [http-9823-1] [renderer.v2.components.MacroRendererComponent] processMacro Unexpected error formatting macro: recently-updated-dashboard -- referer: http://HOST:PORT/admin/search-indexes.action | url: /dashboard.action | userName: admin | action: dashboard java.lang.NullPointerException at com.atlassian.core.util.ImageInfo.read(ImageInfo.java:1228) at com.atlassian.core.util.ImageInfo.check(ImageInfo.java:249) at com.atlassian.confluence.pages.attachments.DefaultImageDetailsManager.buildImageDetails(DefaultImageDetailsManager.java:87) at com.atlassian.confluence.pages.attachments.DefaultImageDetailsManager.createImageDetails(DefaultImageDetailsManager.java:56) at com.atlassian.confluence.pages.attachments.DefaultImageDetailsManager.getImageDetails(DefaultImageDetailsManager.java:48) at com.atlassian.confluence.pages.thumbnail.DefaultThumbnailManager.getThumbnailInfo(DefaultThumbnailManager.java:132) at com.atlassian.confluence.pages.thumbnail.DefaultThumbnailManager.getThumbnailInfo(DefaultThumbnailManager.java:127) at com.atlassian.confluence.util.DefaultThumbnailInfoFactory.getThumbnailInfo(DefaultThumbnailInfoFactory.java:22) at com.atlassian.confluence.plugins.macros.dashboard.RecentlyUpdatedContentMacro.addThumbnailData(RecentlyUpdatedContentMacro.java:406) at com.atlassian.confluence.plugins.macros.dashboard.RecentlyUpdatedContentMacro.getChangeSets(RecentlyUpdatedContentMacro.java:357) at com.atlassian.confluence.plugins.macros.dashboard.RecentlyUpdatedContentMacro.execute(RecentlyUpdatedContentMacro.java:303) at com.atlassian.confluence.macro.ContentFilteringMacro.execute(ContentFilteringMacro.java:106) at com.atlassian.renderer.v2.macro.ResourceAwareMacroDecorator.execute(ResourceAwareMacroDecorator.java:51) at com.atlassian.renderer.v2.components.MacroRendererComponent.executeMacro(MacroRendererComponent.java:188) at com.atlassian.renderer.v2.components.MacroRendererComponent.processMacro(MacroRendererComponent.java:154) at com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:58) at com.atlassian.renderer.v2.components.WikiContentRendererHandler.handleMacro(WikiContentRendererHandler.java:18) at com.atlassian.renderer.v2.WikiMarkupParser.makeMacro(WikiMarkupParser.java:120) at com.atlassian.renderer.v2.WikiMarkupParser.handlePotentialMacro(WikiMarkupParser.java:105) at com.atlassian.renderer.v2.WikiMarkupParser.parse(WikiMarkupParser.java:60) at com.atlassian.renderer.v2.components.MacroRendererComponent.render(MacroRendererComponent.java:43) at com.atlassian.renderer.v2.V2Renderer.render(V2Renderer.java:53) at com.atlassian.renderer.v2.plugin.PluggableV2Renderer.render(PluggableV2Renderer.java:30) at com.atlassian.renderer.v2.V2RendererFacade.convertWikiToXHtml(V2RendererFacade.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) ... {noformat} The NPE is being thrown because the DefaultAttachmentManager cannot find the attachment in the getAttachmentData(Attachment) method. This is most likely because when copying the {{<CONFLUENCE_HOME>}} and the database over from production to test on the test server, they were copied over from a live instance and are slightly out of sync, hence the attachment does not exist in the home directory though it does in the database. Point of the story is, we shouldn't be throwing NPEs :)

    Atlassian JIRA | 7 years ago | Partha Kamal [Atlassian]
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at com.atlassian.core.util.ImageInfo.read()
    2. com.atlassian.core
      ImageInfo.check
      1. com.atlassian.core.util.ImageInfo.read(ImageInfo.java:1228)
      2. com.atlassian.core.util.ImageInfo.check(ImageInfo.java:249)
      2 frames
    3. com.atlassian.confluence
      ContentFilteringMacro.execute
      1. com.atlassian.confluence.pages.attachments.DefaultImageDetailsManager.buildImageDetails(DefaultImageDetailsManager.java:87)
      2. com.atlassian.confluence.pages.attachments.DefaultImageDetailsManager.createImageDetails(DefaultImageDetailsManager.java:56)
      3. com.atlassian.confluence.pages.attachments.DefaultImageDetailsManager.getImageDetails(DefaultImageDetailsManager.java:48)
      4. com.atlassian.confluence.pages.thumbnail.DefaultThumbnailManager.getThumbnailInfo(DefaultThumbnailManager.java:132)
      5. com.atlassian.confluence.pages.thumbnail.DefaultThumbnailManager.getThumbnailInfo(DefaultThumbnailManager.java:127)
      6. com.atlassian.confluence.util.DefaultThumbnailInfoFactory.getThumbnailInfo(DefaultThumbnailInfoFactory.java:22)
      7. com.atlassian.confluence.plugins.macros.dashboard.RecentlyUpdatedContentMacro.addThumbnailData(RecentlyUpdatedContentMacro.java:406)
      8. com.atlassian.confluence.plugins.macros.dashboard.RecentlyUpdatedContentMacro.getChangeSets(RecentlyUpdatedContentMacro.java:357)
      9. com.atlassian.confluence.plugins.macros.dashboard.RecentlyUpdatedContentMacro.execute(RecentlyUpdatedContentMacro.java:303)
      10. com.atlassian.confluence.macro.ContentFilteringMacro.execute(ContentFilteringMacro.java:106)
      10 frames
    4. com.atlassian.renderer
      V2RendererFacade.convertWikiToXHtml
      1. com.atlassian.renderer.v2.macro.ResourceAwareMacroDecorator.execute(ResourceAwareMacroDecorator.java:51)
      2. com.atlassian.renderer.v2.components.MacroRendererComponent.executeMacro(MacroRendererComponent.java:188)
      3. com.atlassian.renderer.v2.components.MacroRendererComponent.processMacro(MacroRendererComponent.java:154)
      4. com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:58)
      5. com.atlassian.renderer.v2.components.WikiContentRendererHandler.handleMacro(WikiContentRendererHandler.java:18)
      6. com.atlassian.renderer.v2.WikiMarkupParser.makeMacro(WikiMarkupParser.java:120)
      7. com.atlassian.renderer.v2.WikiMarkupParser.handlePotentialMacro(WikiMarkupParser.java:105)
      8. com.atlassian.renderer.v2.WikiMarkupParser.parse(WikiMarkupParser.java:60)
      9. com.atlassian.renderer.v2.components.MacroRendererComponent.render(MacroRendererComponent.java:43)
      10. com.atlassian.renderer.v2.V2Renderer.render(V2Renderer.java:53)
      11. com.atlassian.renderer.v2.plugin.PluggableV2Renderer.render(PluggableV2Renderer.java:30)
      12. com.atlassian.renderer.v2.V2RendererFacade.convertWikiToXHtml(V2RendererFacade.java:57)
      12 frames
    5. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    6. Spring AOP
      AopUtils.invokeJoinpointUsingReflection
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
      1 frame