java.lang.ClassCastException: com.atlassian.confluence.pages.Comment

Atlassian JIRA | Don Willis [Atlassian] | 9 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Putting an \{excerpt\} macro in a comment (which admittedly may make no sense) now produces this error message in the comment: Error formatting macro: excerpt: java.lang.ClassCastException: com.atlassian.confluence.pages.Comment And this stacktrace in the log: {noformat} 2007-09-17 21:25:00,596 ERROR [http-8080-Processor25] [renderer.v2.components.MacroRendererComponent] processMacro Unexpected error formatting macro: excerpt -- url: /display/~don.willis@atlassian.com/Home | userName: don.willis@atlassian.com | action: viewpage | page: 16482364 java.lang.ClassCastException: com.atlassian.confluence.pages.Comment at com.atlassian.confluence.renderer.v2.macros.ExcerptMacro.execute(ExcerptMacro.java:63) at com.atlassian.renderer.v2.macro.ResourceAwareMacroDecorator.execute(ResourceAwareMacroDecorator.java:45) at com.atlassian.renderer.v2.components.MacroRendererComponent.processMacro(MacroRendererComponent.java:254) at com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:150) at com.atlassian.renderer.v2.components.WikiContentRendererHandler.handleMacro(WikiContentRendererHandler.java:18) ... {noformat} The reason for this is pretty clear: That line is casting the Comment to an (AbstractPage). The scary bit is that the convertXHtmlToWikiMarkup method to which the AbstractPage would be passed, doesn't even use that page, so passing (AbstractPage)null would work (but obviously isn't a good idea). This seems to have come in with the fix for CONF-6342.

    Atlassian JIRA | 9 years ago | Don Willis [Atlassian]
    java.lang.ClassCastException: com.atlassian.confluence.pages.Comment
  2. 0

    Putting an \{excerpt\} macro in a comment (which admittedly may make no sense) now produces this error message in the comment: Error formatting macro: excerpt: java.lang.ClassCastException: com.atlassian.confluence.pages.Comment And this stacktrace in the log: {noformat} 2007-09-17 21:25:00,596 ERROR [http-8080-Processor25] [renderer.v2.components.MacroRendererComponent] processMacro Unexpected error formatting macro: excerpt -- url: /display/~don.willis@atlassian.com/Home | userName: don.willis@atlassian.com | action: viewpage | page: 16482364 java.lang.ClassCastException: com.atlassian.confluence.pages.Comment at com.atlassian.confluence.renderer.v2.macros.ExcerptMacro.execute(ExcerptMacro.java:63) at com.atlassian.renderer.v2.macro.ResourceAwareMacroDecorator.execute(ResourceAwareMacroDecorator.java:45) at com.atlassian.renderer.v2.components.MacroRendererComponent.processMacro(MacroRendererComponent.java:254) at com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:150) at com.atlassian.renderer.v2.components.WikiContentRendererHandler.handleMacro(WikiContentRendererHandler.java:18) ... {noformat} The reason for this is pretty clear: That line is casting the Comment to an (AbstractPage). The scary bit is that the convertXHtmlToWikiMarkup method to which the AbstractPage would be passed, doesn't even use that page, so passing (AbstractPage)null would work (but obviously isn't a good idea). This seems to have come in with the fix for CONF-6342.

    Atlassian JIRA | 9 years ago | Don Willis [Atlassian]
    java.lang.ClassCastException: com.atlassian.confluence.pages.Comment

    Root Cause Analysis

    1. java.lang.ClassCastException

      com.atlassian.confluence.pages.Comment

      at com.atlassian.confluence.renderer.v2.macros.ExcerptMacro.execute()
    2. com.atlassian.confluence
      ExcerptMacro.execute
      1. com.atlassian.confluence.renderer.v2.macros.ExcerptMacro.execute(ExcerptMacro.java:63)
      1 frame
    3. com.atlassian.renderer
      WikiContentRendererHandler.handleMacro
      1. com.atlassian.renderer.v2.macro.ResourceAwareMacroDecorator.execute(ResourceAwareMacroDecorator.java:45)
      2. com.atlassian.renderer.v2.components.MacroRendererComponent.processMacro(MacroRendererComponent.java:254)
      3. com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:150)
      4. com.atlassian.renderer.v2.components.WikiContentRendererHandler.handleMacro(WikiContentRendererHandler.java:18)
      4 frames