NPE on link replacement for invalid links
-----------------------------------------

                 Key: MAGNOLIA-2768
                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-2768
             Project: Magnolia
          Issue Type: Bug
          Components: fckeditor
    Affects Versions: 4.1 RC4
            Reporter: Fabrizio Giustina
            Assignee: Fabrizio Giustina
            Priority: Minor


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


{noformat}
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)
{noformat}

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:


{code:java}

    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);
{code}


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


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to