Project: JDT
Bug 66260 [templates] Template Evaluation Error
Reported: 2004-06-09 04:38:33 | Status: verified fixed

3.0 RC1 Occured suddenly when invoking code assist after "syn" to build a synchronized block. First the content assist opens showing all found proposals. The first is the synchronized template. Than before I can continue an empty dialog pops up with the title "Template Evaluation Error". Actually there are to exceptions logged, one immediately when the empty dialog pops up and one when I click "Ok" in the dialog. First exceptions: !ENTRY org.eclipse.jdt.ui 4 10001 Jun 09, 2004 10:34:45.859 !MESSAGE Internal Error !STACK 1 org.eclipse.core.runtime.CoreException[0]: org.eclipse.jface.text.BadLocationException at org.eclipse.jdt.internal.corext.template.java.JavaFormatter.format (JavaFormatter.java:106) at org.eclipse.jdt.internal.corext.template.java.JavaContext.evaluate (JavaContext.java:135) at org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateProposal.getAdd itionalProposalInfo(TemplateProposal.java:328) at org.eclipse.jface.text.contentassist.AdditionalInfoController.computeInformatio n(AdditionalInfoController.java:224) at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation (AbstractInformationControlManager.java:759) at org.eclipse.jface.text.AbstractInformationControlManager.showInformation (AbstractInformationControlManager.java:749) at org.eclipse.jface.text.contentassist.AdditionalInfoController$1.run (AdditionalInfoController.java:176) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:106) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2693) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2385) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:253) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:334) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:638) at org.eclipse.core.launcher.Main.main(Main.java:622) !SUBENTRY 1 org.eclipse.jdt.ui 4 0 Jun 09, 2004 10:34:45.859 !MESSAGE !STACK 0 org.eclipse.jface.text.BadLocationException at org.eclipse.jdt.internal.corext.template.java.JavaFormatter.format (JavaFormatter.java:106) at org.eclipse.jdt.internal.corext.template.java.JavaContext.evaluate (JavaContext.java:135) at org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateProposal.getAdd itionalProposalInfo(TemplateProposal.java:328) at org.eclipse.jface.text.contentassist.AdditionalInfoController.computeInformatio n(AdditionalInfoController.java:224) at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation (AbstractInformationControlManager.java:759) at org.eclipse.jface.text.AbstractInformationControlManager.showInformation (AbstractInformationControlManager.java:749) at org.eclipse.jface.text.contentassist.AdditionalInfoController$1.run (AdditionalInfoController.java:176) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:106) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2693) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2385) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:253) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:334) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:638) at org.eclipse.core.launcher.Main.main(Main.java:622) !ENTRY org.eclipse.ui 4 4 Jun 09, 2004 10:36:10.718 !MESSAGE Unhandled event loop exception !ENTRY org.eclipse.ui 4 0 Jun 09, 2004 10:36:10.750 !MESSAGE Failed to execute runnable (java.lang.NullPointerException) !STACK 0 After I click ok on the empty dialog, the following is logged: !ENTRY org.eclipse.ui 4 4 Jun 09, 2004 10:36:10.718 !MESSAGE Unhandled event loop exception !ENTRY org.eclipse.ui 4 0 Jun 09, 2004 10:36:10.750 !MESSAGE Failed to execute runnable (java.lang.NullPointerException) !STACK 0 org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) at org.eclipse.swt.SWT.error(SWT.java:2691) at org.eclipse.swt.SWT.error(SWT.java:2616) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:109) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2693) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2385) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:253) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:334) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:638) at org.eclipse.core.launcher.Main.main(Main.java:622) !ENTRY org.eclipse.ui 4 4 Jun 09, 2004 10:36:10.812 !MESSAGE *** SWT nested exception !ENTRY org.eclipse.ui 4 0 Jun 09, 2004 10:36:10.843 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at org.eclipse.jface.text.contentassist.AdditionalInfoController.computeInformatio n(AdditionalInfoController.java:234) at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation (AbstractInformationControlManager.java:759) at org.eclipse.jface.text.AbstractInformationControlManager.showInformation (AbstractInformationControlManager.java:749) at org.eclipse.jface.text.contentassist.AdditionalInfoController$1.run (AdditionalInfoController.java:176) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:106) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2693) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2385) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:253) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:334) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:638) at org.eclipse.core.launcher.Main.main(Main.java:622)

Files changed in fix:
org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/template/java/ExclusivePositionUpdater.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/template/java/JavaFormatter.java