Project: Eclipse_Platform_UI
Bug 22966 [Properties view] NPE in ResourcePropertySource
Reported: 2002-08-28 22:55:46 | Status: resolved fixed

The following exception occurs when a project is removed from a custom Navigator view, causing the Properties view to be updated. The problem code in ResourcePropertySource.getDateStringValue() is: File localFile = resource.getLocation().toFile(); The NPE occurs because Resource.getLocation() returns a null when the project doesn't exist. There should be a null pointer check before invoking toFile(). Thanks. !ENTRY org.eclipse.ui 4 2 Aug 28, 2002 18:12:32.995 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui". !STACK 0 java.lang.NullPointerException at org.eclipse.ui.views.properties.ResourcePropertySource.getDateStringValue (ResourcePropertySource.java:88) at org.eclipse.ui.views.properties.ResourcePropertySource.getPropertyValue (ResourcePropertySource.java:116) at org.eclipse.ui.views.properties.PropertySheetEntry.refreshValues (PropertySheetEntry.java:491) at org.eclipse.ui.views.properties.PropertySheetEntry.refreshChildEntries (PropertySheetEntry.java:457) at org.eclipse.ui.views.properties.PropertySheetEntry.setValues (PropertySheetEntry.java:613) at org.eclipse.ui.views.properties.PropertySheetViewer.setInput (PropertySheetViewer.java:725) at org.eclipse.ui.views.properties.PropertySheetPage.selectionChanged (PropertySheetPage.java:322) at org.eclipse.ui.views.properties.PropertySheet.selectionChanged (PropertySheet.java:203) at org.eclipse.ui.internal.AbstractSelectionService$3.run (AbstractSelectionService.java:137) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:831) at org.eclipse.core.runtime.Platform.run(Platform.java:416) at org.eclipse.ui.internal.AbstractSelectionService.fireSelection (AbstractSelectionService.java:135) at org.eclipse.ui.internal.AbstractSelectionService$1.selectionChanged (AbstractSelectionService.java:50) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged (Viewer.java:147) at org.eclipse.jface.viewers.StructuredViewer.updateSelection (StructuredViewer.java:1155) at org.eclipse.jface.viewers.StructuredViewer.handleInvalidSelection (StructuredViewer.java:514) at org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer.handleInvalidSelection (ProblemTreeViewer.java:154) at org.eclipse.jface.viewers.StructuredViewer.preservingSelection (StructuredViewer.java:700) at org.eclipse.jface.viewers.AbstractTreeViewer.remove (AbstractTreeViewer.java:961) at org.eclipse.jface.viewers.AbstractTreeViewer.remove (AbstractTreeViewer.java:981) at com.ibm.etools.webtools.webview.eclipse.JavaElementContentProvider$4.run (JavaElementContentProvider.java:313) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:31) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:95) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1506) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1294) at org.eclipse.jface.operation.ModalContext$ModalContextThread.block (ModalContext.java:133) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:258) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run (ProgressMonitorDialog.java:376) at org.eclipse.ui.actions.DeleteResourceAction.run (DeleteResourceAction.java:366) at com.ibm.etools.j2ee.common.ui.J2EEDeleteAction.runResourceDeleteAction (J2EEDeleteAction.java:309) at com.ibm.etools.j2ee.common.ui.J2EEDeleteAction.run (J2EEDeleteAction.java:186) at com.ibm.etools.webtools.webview.eclipse.DualReorgAction.run (DualReorgAction.java:35) at com.ibm.etools.webtools.webview.eclipse.DualReorgAction.run (DualReorgAction.java:35) at com.ibm.etools.webtools.webview.eclipse.CCPActionGroup.handleKeyPressed (CCPActionGroup.java:151) at com.ibm.etools.webtools.webview.actions.WebViewActionGroup.handleKeyPressed (WebViewActionGroup.java:233) at com.ibm.etools.webtools.webview.WebViewPart.handleKeyPressed (WebViewPart.java:579) at com.ibm.etools.webtools.webview.WebViewPart$7.keyPressed (WebViewPart.java:379) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:118) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291) 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:432) at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24)

Files changed in fix:
bundles/org.eclipse.ui/Eclipse UI Standard Components/org/eclipse/ui/views/properties/FilePropertySource.java bundles/org.eclipse.ui/Eclipse UI Standard Components/org/eclipse/ui/views/properties/ResourcePropertySource.java