Tagir Valeev created JBIDE-17433:
------------------------------------
Summary: 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:
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;
}
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)