Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-2768

NPE on link replacement for invalid links in fckedit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.1.1
    • None
    • fckeditor
    • None

      This happened with a link to a resource not existing anymore in the dms repository, although it can't be reproduced easily:

      java.lang.NullPointerException
      	at java.util.regex.Matcher.getTextLength(Unknown Source)
      	at java.util.regex.Matcher.reset(Unknown Source)
      	at java.util.regex.Matcher.<init>(Unknown Source)
      	at java.util.regex.Pattern.matcher(Unknown Source)
      	at info.magnolia.module.fckeditor.dialogs.FckEditorDialog.convertToView(FckEditorDialog.java:407)
      	at info.magnolia.module.fckeditor.dialogs.FckEditorDialog.drawHtml(FckEditorDialog.java:281)
      	at info.magnolia.cms.gui.dialog.DialogControlImpl.drawSubs(DialogControlImpl.java:322)
      	at info.magnolia.cms.gui.dialog.DialogControlImpl.drawHtml(DialogControlImpl.java:166)
      

      fckedit crashes during link resolving and the dialog can't be open anymore. Looking at the code it seems LinkUtil.convertUUIDsToEditorLinks(value) returns a null value and the following regexp fails:

          public String convertToView(String value) {
      
              if (value != null) {
                  // we have to add the context path for images and files but not for pages!
                  value = LinkUtil.convertUUIDsToEditorLinks(value);
      
                  // this section is for backward compatibility - see MAGNOLIA-2088
                  final Matcher matcher = LinkHelper.LINK_OR_IMAGE_PATTERN.matcher(value);
      

      it may worth to add a simple null check before the additional replacement...

        Acceptance criteria

              gjoseph Magnolia International
              fgiust Fabrizio Giustina
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD