Bug 59358 - Can't create new class
Summary: Can't create new class
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-20 18:06 EDT by Jared Burns CLA
Modified: 2004-05-19 12:35 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Burns CLA 2004-04-20 18:06:07 EDT
Build 200404201300

When I use the New Class wizard to create a class, the following exception occurs on Finish. The 
new .java file is created with no contents.

java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:313)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:252)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:753)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard.performFinish(NewElementWizard.java:
110)
at org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.
performFinish(NewClassCreationWizard.java:62)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:613)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:330)
at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:413)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:939)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1995)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1768)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:670)
at org.eclipse.jface.window.Window.open(Window.java:650)
at org.eclipse.jdt.internal.ui.wizards.AbstractOpenWizardAction.run(AbstractOpenWizardAction.
java:158)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
at org.eclipse.jface.action.ActionContributionItem.
handleWidgetSelection(ActionContributionItem.java:550)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:502)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:
435)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:939)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1995)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1768)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1437)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1408)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:244)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:140)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:90)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:280)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:240)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:117)
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:267)
at org.eclipse.core.launcher.Main.run(Main.java:699)
at org.eclipse.core.launcher.Main.main(Main.java:683)
Caused by: java.lang.NullPointerException
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions.
set(DefaultCodeFormatterOptions.java:413)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions.
<init>(DefaultCodeFormatterOptions.java:228)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.<init>(DefaultCodeFormatter.java:49)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.<init>(DefaultCodeFormatter.java:62)
at org.eclipse.jdt.core.ToolFactory.createCodeFormatter(ToolFactory.java:96)
at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.format2(CodeFormatterUtil.java:148)
at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.format2(CodeFormatterUtil.java:152)
at org.eclipse.jdt.internal.corext.codemanipulation.ImportsStructure.
useSpaceBetweenGroups(ImportsStructure.java:754)
at org.eclipse.jdt.internal.corext.codemanipulation.ImportsStructure.
getReplaceString(ImportsStructure.java:667)
at org.eclipse.jdt.internal.corext.codemanipulation.ImportsStructure.create(ImportsStructure.
java:576)
at org.eclipse.jdt.ui.wizards.NewTypeWizardPage$ImportsManager.
create(NewTypeWizardPage.java:146)
at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:1469)
at org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.
finishPage(NewClassCreationWizard.java:49)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:103)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:34)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:700)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1640)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:3262)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.
run(WorkbenchRunnableAdapter.java:61)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:302)
... 38 more
Comment 1 Dirk Baeumer CLA 2004-04-21 03:53:29 EDT
NPE happens in org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions
Comment 2 Olivier Thomann CLA 2004-04-21 11:50:59 EDT
What VM are you using?
The line on which you get the NPE is:
		final Object alignmentForArgumentsInAllocationExpressionOption =
settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION);

So this means that settings is null.

But in the stack trace, settings cannot be null.
We have this call:
		if (settings == null) return;
		set(settings);
Comment 3 Olivier Thomann CLA 2004-04-23 09:25:58 EDT
Without further details from you, I will close as WORKSFORME.
Comment 4 Jared Burns CLA 2004-04-23 10:52:36 EDT
I was on JDK 1.4.2.
Comment 5 Olivier Thomann CLA 2004-04-23 10:54:56 EDT
From Sun or IBM? If IBM, using J9 or not?
Comment 6 Jared Burns CLA 2004-04-23 13:09:44 EDT
Sorry. I actually lied. I *thought* I was using Sun JDK 1.4.2, but I was actually using Sun JDK 1.4.
1. I haven't seen this again since it first happened so I'm reducing the severity. Are there any 
opportunities for multi-threaded timing problems in this area? I didn't fake this stack trace, I swear. 
:-)
Comment 7 Olivier Thomann CLA 2004-04-23 13:13:18 EDT
I simply don't see how it is possible to get this stack trace looking at the
code. If settings is null, the line (that causes the NPE) should never run.
Comment 8 Jared Burns CLA 2004-04-23 13:16:30 EDT
That's why I asked about a timing problem. Can "settings" get nulled out in another thread after the 
null check?
Comment 9 Olivier Thomann CLA 2004-04-26 10:15:56 EDT
settings is not an instance variable. It is a parameter of a method. So the
problem should be local to that method. I don't see how settings can be null.
Comment 10 Olivier Thomann CLA 2004-05-12 14:59:31 EDT
Close as WORKSFORME.
Please reopen if you have steps to reproduce.