Summary: | NPE in LauncherUtils getTimeStamp | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] PDE | Reporter: | James Blackburn <jamesblackburn+eclipse> | ||||
Component: | UI | Assignee: | Jakub Jurkiewicz <jakub.jurkiewicz> | ||||
Status: | RESOLVED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | baumanbr | ||||
Version: | 3.3.1 | Keywords: | bugday, contributed | ||||
Target Milestone: | --- | Flags: | baumanbr:
review+
|
||||
Hardware: | PC | ||||||
OS: | Linux-GTK | ||||||
Whiteboard: | |||||||
Bug Depends on: | |||||||
Bug Blocks: | 219119 | ||||||
Attachments: |
|
Description
James Blackburn
2007-12-11 17:55:34 EST
Are you able to reproduce this? The code in question comes from calls to java.io.File. We seem to be getting null when we call File.listFiles(). From the javadoc, it appears this is the case when the File is not a directory (we call isDirectory() prior) or there is an I/O Exception. I am wondering what is failing in the call... I can't readily reproduce it, but java.io.File documentation (http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#listFiles()) says: "Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs." And it a quick google seems to show a Java bug filed for the possibility isDirectory() && listFiles==null (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4803836) It would seem to be the case that if the the directory disappeared (for whatever reason) between the two method calls, null would be returned by listFiles instead of an Exception being thrown or an empty list returned, which is counterintuitive... I can see this possibly happening with the classfile output directory. To prevent this (and since it is not readily reproducible), we should put the null check. Adding bugday tag as this should be a simple fix. Created attachment 88389 [details]
Patch attached
The attached patch adds null checking. I hope this is enough.
Thank you for the patch, Jakub! I will try to review it today. Beautiful and elegant :) Thanks a lot of the patch. Sounds like a pretty nasty side effect that hopefully no one else will have to deal with now. If you interested on being added to the PDE wall of over achievers (http://www.eclipse.org/pde/pde-ui/committers/committers.php), please send me a photo with a green leafy back ground and we will make sure it gets up. |