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

misleading error message by contentbylabel macro if space not found

    XMLWordPrintable

Details

    Description

      Summary
      Confluence does not properly handle the events in the "confluence-advanced-macros", particularly while using ""contentbylabel" macro. The Macro will throw non-user friendly and misleading error in the UI. For example if the "content by label" contains a label filter to a deleted space, the Confluence will throw the following error in the UI and a huge error of stacktraces in the logs. :

      Error rendering macro 'contentbylabel'
      parameters should not be empty

      The stacktrace floods the logs which make it hard for the customer to review their system.

      Step to Replicate

      Case : 1

      1. Create a space (spaceA)
      2. Create a page (page1) under spaceA
      3. Add a label(test) in page1
      4. Add 'content by label' macro in a Confluence page
      5. Configure the macro as follows: label = test, of type = page, in space = spaceA then save the page
      6. Delete the spaceA

      Case : 2

      • Import a space from another Confluence instance and then pages in the existing instance using the "content by label" macro have a reference to a space which does not exist.

      Observed Behaviour

      • The following error appear in the UI:

        Error rendering macro 'contentbylabel'
        parameters should not be empty

      • The following list of stacktraces is added to the logs:
        2023-02-10 04:46:33,384 ERROR [http-nio-8090-exec-3] [xhtml.view.macro.ViewMacroMarshaller] handleMacroExecutionException Error rendering macro: contentbylabel
         -- url: /display/IS/test+PSSRV | page: 32964616 | traceId: 00064c67fb3c03b8 | userName: admin | referer: http://localhost:8090/display/IS/IT+Central | action: viewpage
        java.lang.IllegalArgumentException: parameters should not be empty
        	at com.atlassian.confluence.search.v2.query.AbstractParameterListQuery.<init>(AbstractParameterListQuery.java:27)
        	at com.atlassian.confluence.search.v2.query.InSpaceQuery.<init>(InSpaceQuery.java:31)
        	at com.atlassian.confluence.plugins.cql.fields.SpaceKeyFieldHandler.build(SpaceKeyFieldHandler.java:47)
        	at com.atlassian.confluence.plugins.cql.fields.SpaceFieldHandler.build(SpaceFieldHandler.java:39)
        	at com.atlassian.confluence.plugins.cql.fields.SpaceFieldHandler.build(SpaceFieldHandler.java:17)
        	at com.atlassian.confluence.plugins.cql.impl.CQLtoV2SearchParseTreeVisitor.visitEntityExpr(CQLtoV2SearchParseTreeVisitor.java:170)
        	at com.atlassian.confluence.plugins.cql.impl.CQLtoV2SearchParseTreeVisitor.visitEntityExpr(CQLtoV2SearchParseTreeVisitor.java:30)
        	at com.atlassian.querylang.antlrgen.AqlParser$EntityExprContext.accept(AqlParser.java:2035)
        	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72)
        	at com.atlassian.querylang.antlrgen.AqlBaseVisitor.visitExpr(AqlBaseVisitor.java:300)
        	at com.atlassian.confluence.plugins.cql.impl.CQLtoV2SearchParseTreeVisitor.visitSubClause(CQLtoV2SearchParseTreeVisitor.java:101)
        	at com.atlassian.confluence.plugins.cql.impl.CQLtoV2SearchParseTreeVisitor.visitNotClause(CQLtoV2SearchParseTreeVisitor.java:87)
        	at com.atlassian.confluence.plugins.cql.impl.CQLtoV2SearchParseTreeVisitor.visitAndClause(CQLtoV2SearchParseTreeVisitor.java:68)
        	at com.atlassian.confluence.plugins.cql.impl.CQLtoV2SearchParseTreeVisitor.visitOrClause(CQLtoV2SearchParseTreeVisitor.java:53)
        	at com.atlassian.confluence.plugins.cql.impl.CQLtoV2SearchParseTreeVisitor.visitOrClause(CQLtoV2SearchParseTreeVisitor.java:30)
        	at com.atlassian.querylang.antlrgen.AqlParser$OrClauseContext.accept(AqlParser.java:903)
        	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72)
        	at com.atlassian.querylang.antlrgen.AqlBaseVisitor.visitClause(AqlBaseVisitor.java:316)
        	at com.atlassian.querylang.antlrgen.AqlParser$ClauseContext.accept(AqlParser.java:853)
        	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72)
        	at com.atlassian.querylang.antlrgen.AqlBaseVisitor.visitAqlStatement(AqlBaseVisitor.java:420)
        	at com.atlassian.querylang.antlrgen.AqlParser$AqlStatementContext.accept(AqlParser.java:612)
        	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:44)
        	at com.atlassian.confluence.plugins.cql.impl.DefaultCQLSearchService.parseSearchQuery(DefaultCQLSearchService.java:355)
        	at com.atlassian.confluence.plugins.cql.impl.DefaultCQLSearchService.performV2Search(DefaultCQLSearchService.java:278)
        	at com.atlassian.confluence.plugins.cql.impl.DefaultCQLSearchService.searchContent(DefaultCQLSearchService.java:196)
        	at com.atlassian.confluence.plugins.cql.impl.DefaultCQLSearchService.searchContent(DefaultCQLSearchService.java:144)
        	at com.atlassian.confluence.plugins.macros.advanced.contentbylabel.LabelledContentMacro.makeRenderContext(LabelledContentMacro.java:95)
        ...
        	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        	at java.base/java.lang.Thread.run(Thread.java:834)
        

      What needs to be fixed

      • The Confluence should gracefully handles the error by informing the user "The space has been deleted" or "Space not found" on the UI
      • A short but relevant stacktrace that tells the user that "The space is missing" is added to the exception handling. 

      Attachments

        Activity

          People

            Unassigned Unassigned
            3297cf7d7ee0 Arun Suryawanshi
            Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: