Project: JDT
Bug 23069 Class wizard fails with file/typecomment enabled [regression] build I0827
Reported: 2002-08-31 10:29:20 | Status: verified fixed

When creating a new class or interface with the wizards, the evaluation of the file/typecomment templates fails, generation the following error log: *** Error Log: !SESSION Aug 31, 2002 08:36:29.537 --------------------------------------------- java.version=1.4.1-rc java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_CA Command-line arguments: -os win32 -ws win32 - arch x86 -install file:F:/Java/eclipse/ !ENTRY org.eclipse.jdt.ui 4 1 Aug 31, 2002 08:36:29.537 !MESSAGE Internal Error !STACK 0 java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:310) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:249) at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:717) at org.eclipse.jdt.internal.ui.wizards.NewElementWizard.finishPage(NewElementWizard.java:66) at org.eclipse.jdt.internal.ui.wizards.NewInterfaceCreationWizard.performFinish(NewInterfaceCreationWizard.java:42) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:574) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:312) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:393) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1622) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1368) at org.eclipse.jface.window.Window.runEventLoop(Window.java:562) at org.eclipse.jface.window.Window.open(Window.java:542) at org.eclipse.jdt.internal.ui.wizards.AbstractOpenWizardAction.run(AbstractOpenWizardAction.java:152) at org.eclipse.jdt.internal.ui.wizards.AbstractOpenWizardAction.run(AbstractOpenWizardAction.java:170) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:210) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:196) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:361) at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:352) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:47) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1622) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1368) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1256) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1239) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:775) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) 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:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: java.lang.NullPointerException at org.eclipse.jdt.internal.corext.template.java.JavaContext.evaluateTemplate(JavaContext.java:433) at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.getTemplate(NewTypeWizardPage.java:1561) at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.getTypeComment(NewTypeWizardPage.java:1534) at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.constructTypeStub(NewTypeWizardPage.java:1448) at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:1334) at org.eclipse.jdt.ui.wizards.NewTypeWizardPage$1.run(NewTypeWizardPage.java:1637) at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:39) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:64) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1361) at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:78) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:299) ... 37 more The java file is created, and the class generated, but the templates are missing. Testing shows that even trivial templates cause this error (ie. /** */).

Files changed in fix:
org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/template/TemplateContext.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/template/java/GlobalVariables.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/template/java/JavaContext.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/template/java/JavaDocContext.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/template/TemplateEngine.java