| Summary: | directory.list(filter) is spec'd to return null | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | David Williams <david_williams> | ||||
| Component: | Update (deprecated - use Eclipse>Equinox>p2) | Assignee: | Platform-Update-Inbox <platform-update-inbox> | ||||
| Status: | RESOLVED WONTFIX | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 3.2 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Yes, the problem can arise because checking for null and list directory are not one atomic operation. How did the code behave in this case? Did you have problem continuing regular operations? I think that there is nothing we can do about this. I just got null pointer exceptions, intially. most code immediately after array=list() did array.length hence NPE instead of the "do nothing" logic that was there for the zero size array. In my "whacked" together code, it easy to put in "if null do nothing" sorts of checks and everything continued as expected. Again, not exactly sure even why it occurred sometimes, but I actually saw no ill effects in end results evnen when null was returned. That is, I saw no change in behavior, once NPE was fixed. Sorry i misunderstood what you are saying. I thought you want it to be check beforehand. do you know where exactly in the code this happens? Created attachment 39746 [details]
patch illustrating NPE spots
This patch is a bit sloppy, so take head it's just based on my whacked code, to get be another problem. It does, however, illustrate the 4 spots I was seeing the NPE's. And, again, remember I was seeing these NPE's after modifying other code to return ignore missing plugins.
Hope this patch helps illustrate what I meant. There are, also, other places where list-filter is used, but I never saw NPE's there. (But, in really bullet proof code, might want to be considered).
This is a mass update of Platform Update bugs that have had no activity in three years. Platform Update was replaced in Eclipse 3.4 (2008) by a new provisioning system called Equinox p2. If this bug or enhancement is not already addressed in p2 please enter a new bug report against p2 (RT > Equinox > p2). If you still want to see this bug addressed in the deprecated Platform Update component, please reopen this bug. Patches welcome. |
Throughout update code, it often uses Java constructs like File[] filearray = pluginDirectory.list(); or File[] filearray = featureDirecotry.list(filenamefileter); these 'list' methods are actually spec'd to be be able to return null " *... The array will be empty if the directory is * empty. Returns <code>null</code> if this abstract pathname * does not denote a directory, or if an I/O error occurs. " But in few places is null checked. All the existing code works fine, and I've never seen this in normal use, but in the course of experimenting with posible fixes for bug 137538 I did run into cases where a 'null' was returned. I'm not exactly sure what gave rise the the null cases, since in most places these sections of code are well checked (e.g. that its really a directory). It might be related to the rare ? case of eclipes.org clusters, where, sometimes, there is "access forbidden" on one file system while it replicates ... or something? I'm just documenting there, since I did encounter it, and in case anyone really wants to bullet proof that upate code.