]
Fred Bricon commented on JBIDE-17433:
-------------------------------------
Thanks Tagir, do you want to try and submit a pull request? See
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}