[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 20 02:59:25 EDT 2014


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

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

The freemarker plugins need to be rebuilt. See  JBIDE-17652.

> 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
>            Assignee: Denis Golovin
>             Fix For: 4.2.0.Beta3
>
>
> NullPointerException occurs 
> {code}java.lang.NullPointerException
> 	at org.jboss.ide.eclipse.freemarker.model.MacroDirective.compareTo(MacroDirective.java:128)
> 	at java.util.ComparableTimSort.countRunAndMakeAscending(Unknown Source)
> 	at java.util.ComparableTimSort.sort(Unknown Source)
> 	at java.util.ComparableTimSort.sort(Unknown Source)
> 	at java.util.Arrays.sort(Unknown Source)
> 	at java.util.Collections.sort(Unknown Source)
> 	at org.jboss.ide.eclipse.freemarker.model.ItemSet.parse(ItemSet.java:169)
> 	at org.jboss.ide.eclipse.freemarker.model.ItemSet.<init>(ItemSet.java:64)
> 	at org.jboss.ide.eclipse.freemarker.editor.Editor.getItemSet(Editor.java:277)
> 	at org.jboss.ide.eclipse.freemarker.editor.Editor.getSelectedItem(Editor.java:249)
> 	at org.jboss.ide.eclipse.freemarker.editor.Editor.keyReleased(Editor.java:374)
> 	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:174)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
> 	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108)
> 	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
> 	at org.eclipse.swt.widgets.Widget.wmKeyUp(Widget.java:1927)
> 	at org.eclipse.swt.widgets.Control.WM_KEYUP(Control.java:4979)
> 	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4644)
> 	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
> 	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4990)
> 	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
> 	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
> 	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
> 	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> 	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
> 	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
> 	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
> 	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> 	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
> 	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
> 	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
> 	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> 	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> 	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
> 	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
> {code}
> 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.6#6264)


More information about the jbosstools-issues mailing list