Uploaded image for project: 'URL Translation'
  1. URL Translation
  2. MURLTRANS-35

Handle broken ckeditor links gracefully

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 6.2.4
    • 6.2.3
    • None

      When using the link feature inside the ckeditor if the node doesn't exist on the public side then this can result in a null pointer.

      Reproduce

      1. Add a rich text on Page A with a link to an unpublished page B
      2. Publish page A from author to public.
      3. Request page A from the public instance.

      Actual
      Component is not fully rendered, and HTML is invalid.

      Expected
      Component should render with a warning about the broken link.

      Notes
      Stack trace.

      Caused by: freemarker.core._MiscTemplateException: Expression has thrown an unchecked exception; see the cause exception.
      The blamed expression:
      ==> cmsfn.decode(content).bodyText  [in template "global/templates/components/contentBlockText/contentBlockText.ftl" at line 9, column 11]
      
      ----
      FTL stack trace ("~" means nesting-related):
      	- Failed at: ${cmsfn.decode(content).bodyText!}  [in template "global/templates/components/contentBlockText/contentBlockText.ftl" at line 9, column 9]
      ----
      	at freemarker.core.Expression.eval(Expression.java:106) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.DefaultToExpression._eval(DefaultToExpression.java:96) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Expression.eval(Expression.java:101) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:104) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.DollarVariable.accept(DollarVariable.java:63) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Environment.visit(Environment.java:335) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Environment.visit(Environment.java:341) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Environment.visit(Environment.java:341) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Environment.process(Environment.java:314) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.template.Template.process(Template.java:383) ~[freemarker-2.3.32.jar:2.3.32]
      	at info.magnolia.freemarker.FreemarkerHelper.render(FreemarkerHelper.java:172) ~[magnolia-freemarker-support-6.2.36.jar:?]
      	at info.magnolia.rendering.renderer.FreemarkerRenderer.onRender(FreemarkerRenderer.java:100) ~[magnolia-rendering-6.2.36.jar:?]
      	... 288 more
      Caused by: java.lang.NullPointerException
      	at info.magnolia.i18n.url.translation.translator.URLTranslator.getPath(URLTranslator.java:113) ~[magnolia-url-translation-6.2.3.jar:?]
      	at info.magnolia.i18n.url.translation.link.multisite.TranslateAbsolutePathTransformer.getTranslatedPath(TranslateAbsolutePathTransformer.java:86) ~[magnolia-url-translation-6.2.3.jar:?]
      	at info.magnolia.i18n.url.translation.link.multisite.TranslateAbsolutePathTransformer.transform(TranslateAbsolutePathTransformer.java:73) ~[magnolia-url-translation-6.2.3.jar:?]
      	at info.magnolia.multisite.CompoundLinkTransformer.transform(CompoundLinkTransformer.java:79) ~[magnolia-module-multisite-2.1.2.jar:?]
      	at info.magnolia.link.LinkUtil.convertLinksFromUUIDPattern(LinkUtil.java:233) ~[magnolia-core-6.2.36.jar:?]
      	at info.magnolia.link.LinkUtil.convertLinksFromUUIDPattern(LinkUtil.java:253) ~[magnolia-core-6.2.36.jar:?]
      	at info.magnolia.jcr.util.ContentMap.getNodeProperty(ContentMap.java:231) ~[magnolia-core-6.2.36.jar:?]
      	at info.magnolia.jcr.util.ContentMap.get(ContentMap.java:172) ~[magnolia-core-6.2.36.jar:?]
      	at info.magnolia.freemarker.models.ContentMapModel.get(ContentMapModel.java:96) ~[magnolia-freemarker-support-6.2.36.jar:?]
      	at freemarker.core.Dot._eval(Dot.java:43) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Expression.eval(Expression.java:101) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.DefaultToExpression._eval(DefaultToExpression.java:96) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Expression.eval(Expression.java:101) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:104) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.DollarVariable.accept(DollarVariable.java:63) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Environment.visit(Environment.java:335) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Environment.visit(Environment.java:341) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Environment.visit(Environment.java:341) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.core.Environment.process(Environment.java:314) ~[freemarker-2.3.32.jar:2.3.32]
      	at freemarker.template.Template.process(Template.java:383) ~[freemarker-2.3.32.jar:2.3.32]
      	at info.magnolia.freemarker.FreemarkerHelper.render(FreemarkerHelper.java:172) ~[magnolia-freemarker-support-6.2.36.jar:?]
      	at info.magnolia.rendering.renderer.FreemarkerRenderer.onRender(FreemarkerRenderer.java:100) ~[magnolia-rendering-6.2.36.jar:?]
      	... 288 more
      ERROR info.magnolia.rendering.engine.ModeDependentRenderExceptionHandler 28.07.2023 10:42:02 -- Error while rendering [/au-rentokil/about/local-branches/albury0/main/01/col-2/01/contentBlocks/01] with template [global:components/contentBlockText/contentBlockText] for URI [/au/about/local-branches/albury0]:
      RenderException: freemarker.core._MiscTemplateException: Expression has thrown an unchecked exception; see the cause exception.
      The blamed expression:
      ==> cmsfn.decode(content).bodyText  [in template "global/templates/components/contentBlockText/contentBlockText.ftl" at line 9, column 11]

        Acceptance criteria

              rgange Richard Gange
              rgange Richard Gange
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Work Started:

                  Bug DoR
                  Task DoD