Bug 81797 - NPE in SortElementBuilder
Summary: NPE in SortElementBuilder
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-22 11:50 EST by John Arthorne CLA
Modified: 2005-03-30 19:28 EST (History)
1 user (show)

See Also:


Attachments
The compilation unit being sorted (has syntax errors) (6.09 KB, text/plain)
2004-12-22 11:51 EST, John Arthorne CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2004-12-22 11:50:40 EST
Build: 3.1 M4

I get a NullPointerException when running the "sort members" command on the
attached compilation unit. Stack:

java.lang.NullPointerException
	at
org.eclipse.jdt.internal.core.SortElementBuilder.searchLineNumber(SortElementBuilder.java:963)
	at
org.eclipse.jdt.internal.core.SortElementBuilder.normalizeSourceStart(SortElementBuilder.java:1162)
	at
org.eclipse.jdt.internal.core.SortElementBuilder$SortElement.<init>(SortElementBuilder.java:46)
	at
org.eclipse.jdt.internal.core.SortElementBuilder$SortType.<init>(SortElementBuilder.java:780)
	at
org.eclipse.jdt.internal.core.SortElementBuilder$SortClassDeclaration.<init>(SortElementBuilder.java:715)
	at
org.eclipse.jdt.internal.core.SortElementBuilder.enterType(SortElementBuilder.java:1076)
	at
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:1139)
	at
org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:736)
	at
org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit(SourceElementParser.java:1282)
	at
org.eclipse.jdt.internal.core.SortElementsOperation.processElement(SortElementsOperation.java:100)
	at
org.eclipse.jdt.internal.core.SortElementsOperation.executeOperation(SortElementsOperation.java:72)
	at
org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:700)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1674)
	at
org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:744)
	at
org.eclipse.jdt.core.util.CompilationUnitSorter.sort(CompilationUnitSorter.java:174)
	at
org.eclipse.jdt.internal.corext.codemanipulation.SortMembersOperation.run(SortMembersOperation.java:257)
	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:1674)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:3672)
	at
org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:65)
	at
org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.internalRun(BusyIndicatorRunnableContext.java:113)
	at
org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.run(BusyIndicatorRunnableContext.java:80)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at
org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext.run(BusyIndicatorRunnableContext.java:126)
	at
org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:1061)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at
org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1057)
	at org.eclipse.jdt.ui.actions.SortMembersAction.run(SortMembersAction.java:226)
	at org.eclipse.jdt.ui.actions.SortMembersAction.run(SortMembersAction.java:167)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:216)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:188)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:989)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:188)
	at org.eclipse.ui.internal.commands.Command.execute(Command.java:130)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:445)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:724)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:767)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:536)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:479)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:221)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:752)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:832)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:857)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:870)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:866)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1171)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3109)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3012)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3370)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1570)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2446)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:285)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:710)
	at org.eclipse.core.launcher.Main.main(Main.java:694)
Comment 1 John Arthorne CLA 2004-12-22 11:51:58 EST
Created attachment 16809 [details]
The compilation unit being sorted (has syntax errors)
Comment 2 Douglas Pollock CLA 2005-03-15 14:18:54 EST
I have seen this exception as well.
Comment 3 Olivier Thomann CLA 2005-03-16 12:53:22 EST
Does your code also contain syntax errors?
Comment 4 Douglas Pollock CLA 2005-03-16 13:47:29 EST
I don't know which file caused the exception.
Comment 5 Olivier Thomann CLA 2005-03-16 14:24:41 EST
Fixed and released in HEAD.
Regression test added in
org.eclipse.jdt.core.tests.model.SortCompilationUnitElementsTests.test022
Comment 6 Olivier Thomann CLA 2005-03-30 19:28:46 EST
Verified in 20050330-0500