Community
Participate
Working Groups
NPE deleting item from Package Explorer with Properties View open. Create a new General Project and a new file inside this project. Open the properties view. From the Package Explorer, delete the file. Result: An NPE occurs. java.lang.NullPointerException at org.eclipse.ui.views.properties.ResourcePropertySource.getPropertyValue(ResourcePropertySource.java:253) at org.eclipse.ui.views.properties.FilePropertySource.getPropertyValue(FilePropertySource.java:71) at org.eclipse.ui.views.properties.PropertySheetEntry.refreshValues(PropertySheetEntry.java:618) at org.eclipse.ui.views.properties.PropertySheetEntry.refreshChildEntries(PropertySheetEntry.java:575) at org.eclipse.ui.views.properties.PropertySheetEntry.setValues(PropertySheetEntry.java:767) at org.eclipse.ui.views.properties.PropertySheetViewer.setInput(PropertySheetViewer.java:943) at org.eclipse.ui.views.properties.PropertySheetPage.selectionChanged(PropertySheetPage.java:473) at org.eclipse.ui.views.properties.PropertySheet.selectionChanged(PropertySheet.java:218) at org.eclipse.ui.internal.AbstractSelectionService.fireSelection(AbstractSelectionService.java:156) at org.eclipse.ui.internal.AbstractSelectionService$1.selectionChanged(AbstractSelectionService.java:62) at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:843) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1976) at org.eclipse.jface.viewers.StructuredViewer.handleInvalidSelection(StructuredViewer.java:1092) at org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer.handleInvalidSelection(ProblemTreeViewer.java:206) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$PackageExplorerProblemTreeViewer.handleInvalidSelection(PackageExplorerPart.java:384) at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1336) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$PackageExplorerProblemTreeViewer.preservingSelection(PackageExplorerPart.java:402) at org.eclipse.jface.viewers.AbstractTreeViewer.remove(AbstractTreeViewer.java:1936) at org.eclipse.jface.viewers.AbstractTreeViewer.remove(AbstractTreeViewer.java:1988) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider$5.run(PackageExplorerContentProvider.java:640) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider$7.run(PackageExplorerContentProvider.java:666) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971) at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:158) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:326) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:304) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:545) at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:154) at org.eclipse.jdt.internal.ui.refactoring.reorg.DeleteWizard$DeleteInputPage.performFinish(DeleteWizard.java:177) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:611) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed(RefactoringWizardDialog2.java:433) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:508) at org.eclipse.jface.dialogs.Dialog$3.widgetSelected(Dialog.java:660) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968) at org.eclipse.jface.window.Window.runEventLoop(Window.java:820) at org.eclipse.jface.window.Window.open(Window.java:796) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:132) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:145) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:40) at org.eclipse.jdt.internal.ui.refactoring.UserInterfaceStarter.activate(UserInterfaceStarter.java:56) at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startDeleteRefactoring(RefactoringExecutionStarter.java:229) at org.eclipse.jdt.internal.ui.refactoring.reorg.DeleteAction.run(DeleteAction.java:83) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:267) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:243) at org.eclipse.jface.action.Action.runWithEvent(Action.java:499) at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:229) at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:119) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:461) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:424) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:160) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:466) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:799) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:846) at org.eclipse.ui.internal.keys.OutOfOrderListener.handleEvent(OutOfOrderListener.java:76) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:965) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:961) at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1560) at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:3567) at org.eclipse.swt.widgets.Tree.WM_KEYDOWN(Tree.java:4878) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3275) at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:4768) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4025) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1923) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:615) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336) at org.eclipse.core.launcher.Main.basicRun(Main.java:280) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
The expression element.getResourceAttributes() will return null for the recently deleted resource.
Created attachment 47162 [details] proposed patch
Boris, the offending code has a TODO that says to remove it when bug 125708 is fixed (which it says it is). Is this code safe to remove now?
*** Bug 157382 has been marked as a duplicate of this bug. ***
*** Bug 154322 has been marked as a duplicate of this bug. ***
I could reproduce the duplicate bug 157382 in M20060912-1730, but not in I20060912-0800. It looks like bug 152586 has fixed this in the 3.3 stream. You might want to fix it in 3.2.1 too.
(In reply to comment #6) > It looks like bug 152586 has fixed this in the 3.3 stream. You might want to > fix it in 3.2.1 too. Unfortunately, we just missed a 3.2.1 rebuild. However, but the bug makes Eclipse look bad, it seems to happen fairly often, and the fix (looking at the proposed patch) seems to be safe. Eric, can you look at the patch again (I don't understand comment #3), and try to get approval for putting this into 3.2.1? We need +1s from two component leads. We should be ready for a new build as soon as possible - looking at the number of changes put into today's M build, it seems likely that yet another build will follow.
Eric is not here today.
Created attachment 50253 [details] the same patch, but with updated line numbers
OK so here is what happens if we don't fix this bug: If the Properties view is open at all, in any perspective, renaming or deleting a file from the Package Explorer will add an entry to the .log "An unexpected exception was thrown.", with a stack trace showing the NPE. We don't open an error dialog. So I still think this looks bad, but not as bad as an error dialog. My suggestion would be to put this into a 3.2.1 rebuild should one happen because of another bug, but not requesting a rebuild for this one alone. McQ?
What I didn't think about is that if unfixed, this will generate a number of bug reports, so it seems worth a rebuild. JohnA, MichaelV, could you please review the patch? Thanks.
+1 the patch looks good (same fix that was already put in HEAD).
+1. Given that this has been separately found (and reported) by at least 5 people in the community, we should fix it for R3.2.1.
+1
Patch released to R3_2_maintenance >20060915-1030.
*** Bug 157509 has been marked as a duplicate of this bug. ***