Bug 29480 - [resources][linked resources] undefined path variable causes NPE in properties dialog
Summary: [resources][linked resources] undefined path variable causes NPE in propertie...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-14 15:29 EST by Jim des Rivieres CLA
Modified: 2003-01-16 10:23 EST (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 Jim des Rivieres CLA 2003-01-14 15:29:25 EST
Build 20030114

1. Create a path variable V1 to a folder that exists, say c:\temp\junk
2. Create a project P1
3. Create a folder P1/f1 linked to path variable V1
4. Select P1/f1 and open properties dialog.
Click OK.

Observe: No problem

5. Delete path variable V1
6. Select P1/f1 and open properties dialog.
Click OK.

Observe: The dialog does not dismiss.

Expectation: Properties dialog should dismiss.

Workaround: Clicking Cancel dismisses the dialog.

Log entry shows an NPE:

!ENTRY org.eclipse.ui 4 0 Jan 14, 2003 15:54:10.527
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
	at 
	at org.eclipse.ui.internal.dialogs.ResourceInfoPage.performOk
(ResourceInfoPage.java:428)
	at org.eclipse.jface.preference.PreferenceDialog.okPressed
(PreferenceDialog.java:616)
	at org.eclipse.jface.preference.PreferenceDialog.buttonPressed
(PreferenceDialog.java:185)
	at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:398)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java
(Compiled Code))
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java
(Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
(Compiled Code))
	at org.eclipse.jface.window.Window.runEventLoop(Window.java(Compiled 
Code))
	at org.eclipse.jface.window.Window.open(Window.java:541)
	at org.eclipse.ui.dialogs.PropertyDialogAction.run
(PropertyDialogAction.java:158)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:804)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:422)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java:374)
	at org.eclipse.jface.action.ActionContributionItem.access$0
(ActionContributionItem.java:368)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java:69)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java
(Compiled Code))
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java
(Compiled Code))
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java
(Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1450)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:845)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
	at java.lang.reflect.Method.invoke(Native Method)
	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)
Comment 1 Knut Radloff CLA 2003-01-14 18:50:28 EST
The NPE happens in Resource.setReadOnly (the blank top line in the stack trace 
above reads org/eclipse/core/internal/resources/Resource.setReadOnly(Z)V on my 
VM).
setReadOnly does not check if the location is not null.
Comment 2 DJ Houghton CLA 2003-01-15 14:22:24 EST
John, please investigate. Thanks.
Comment 3 John Arthorne CLA 2003-01-15 16:20:05 EST
Fixed the NPE.

Knut: As an aside, it's curious that you're calling setReadOnly and setDerived
here, regardless of the fact that the user hasn't changed those values.  You're
doing some extra work "for free" here.  In this case it's just a single resource
so this probably isn't a big issue.
Comment 4 Knut Radloff CLA 2003-01-16 10:23:15 EST
Opened bug 29635 to consider changing the ResourceInfoPage.