[ 
http://jira.magnolia-cms.com/browse/MAGNOLIA-2768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=24281#action_24281
 ] 

Jan Haderka commented on MAGNOLIA-2768:
---------------------------------------

With the current fix the broken link remains in the page, which is all right, 
but would not it be better to make this configurable in the {{LinkFactory}} 
whether in such case the broken link should be rendered or removed (just from 
the rendered content, not from the original) as a means to control broken links 
on the site?

> 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
>            Reporter: Fabrizio Giustina
>            Assignee: Grégory Joseph
>            Priority: Minor
>             Fix For: 4.1.1
>
>
> 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