[jbosstools-issues] [JBoss JIRA] (JBIDE-17433) Null pointer exception in Freemarker IDE when empty macro name typed

Fred Bricon (JIRA) issues at jboss.org
Fri Jun 6 10:32:15 EDT 2014


    [ https://issues.jboss.org/browse/JBIDE-17433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12974189#comment-12974189 ] 

Fred Bricon commented on JBIDE-17433:
-------------------------------------

Thanks Tagir, do you want to try and submit a pull request? See https://github.com/jbosstools/jbosstools-freemarker#contribute-fixes-and-features for details on how to contribute

> Null pointer exception in Freemarker IDE when empty macro name typed
> --------------------------------------------------------------------
>
>                 Key: JBIDE-17433
>                 URL: https://issues.jboss.org/browse/JBIDE-17433
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: freemarker
>         Environment: Windows x86, Eclipse Kepler (seems that issue doesn't depend on environment)
>            Reporter: Tagir Valeev
>
> NullPointerException occurs when editing FTL file in Freemarker IDE due to problem in compareTo function in org.jboss.ide.eclipse.freemarker.model.MacroDirective. Proposed fix:
> {noformat}
>         public int compareTo(Object arg0) {
> -               if (arg0 instanceof MacroDirective)
> -                       return (getName().compareTo(((MacroDirective) arg0).getName()));
> +               if (arg0 instanceof MacroDirective) {
> +                       String name = getName();
> +                       String otherName = ((MacroDirective) arg0).getName();
> +                       if(null == name)
> +                               name = "";
> +                       if(null == otherName)
> +                               otherName = "";
> +                       return (name.compareTo(otherName));
> +        }
>                 else
>                         return 0;
>         }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)


More information about the jbosstools-issues mailing list