Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 319742

Summary: NPE: An internal error occurred during: "Update RPM packages proposal list"
Product: [Tools] Linux Tools Reporter: Severin Gehwolf <sgehwolf>
Component: RPMAssignee: Alexander Kurtakov <akurtakov>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: linux.rpm-inbox, sgehwolf
Version: 0.5   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Bugfix akurtakov: iplog+, akurtakov: review+

Description Severin Gehwolf CLA 2010-07-13 11:34:12 EDT
I keep getting those errors.

java.io.FileNotFoundException: /.pkglist (Permission denied)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:209)
	at java.io.FileWriter.<init>(FileWriter.java:107)
	at org.eclipse.linuxtools.rpm.ui.editor.RpmPackageBuildProposalsJob.retrievePackageList(RpmPackageBuildProposalsJob.java:150)
	at org.eclipse.linuxtools.rpm.ui.editor.RpmPackageBuildProposalsJob.run(RpmPackageBuildProposalsJob.java:59)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 1 Severin Gehwolf CLA 2010-07-16 15:30:28 EDT
Created attachment 174532 [details]
Bugfix

This should fix the problem. Previously system property "user.dir". See http://www.mindspring.com/~mgrand/java-system-properties.htm what that means. I think user.home should be used.

Thanks!
Comment 2 Severin Gehwolf CLA 2010-07-16 15:31:36 EDT
System.getProperty("user.dir") returned "/" on my machine.
Comment 3 Severin Gehwolf CLA 2010-07-19 14:31:50 EDT
(In reply to comment #2)
> System.getProperty("user.dir") returned "/" on my machine.

OK, now I think I know what is going on. Since I launched Eclipse by clicking on the Eclipse icon on a gnome-panel current working directory seemed to evaluate to "/" (I don't know why exactly). I may be wrong with this, but System.getProperty("user.dir") returns the user's CWD. See:
http://download.oracle.com/docs/cd/E17476_01/javase/1.5.0/docs/api/java/lang/System.html#getProperties%28%29

This might evaluate to some unexpected paths.

Here are steps to reproduce:

1. Open terminal
2. $ cd /
3. $ eclipse
4. When a spec file is opened and the updating mechanism of packages list
   kicks in, there should pop up an error as described above.

Compare this to:

1. Open terminal
2. $ cd ~
3. $ eclipse
4. No permission denied errors should occur, since when eclipse was started
   PWD was '~', which is writable.

IMO it would make more sense to use the "user.home" property instead of "user.dir", since it's not sensitive to the user's CWD when eclipse starts up.

Thoughts?
Comment 4 Andrew Overholt CLA 2010-07-19 16:49:47 EDT
"user.home" should be used here, IMO.
Comment 5 Alexander Kurtakov CLA 2010-07-20 10:32:33 EDT
Thanks applied in r25289.