Issue Details (XML | Word | Printable)

Key: XBEAN-92
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Shawn Jiang
Reporter: karan singh malhi
Votes: 0
Watchers: 1
Available Workflow Actions

Reopen Issue
Operations

If you were logged in you would be able to see more operations.
XBean

UrlSet excludePaths() method throws a nullpointer exception if the pathString argument is null

Created: 06/Sep/07 03:02 PM   Updated: 10/Sep/09 09:39 PM
Return to search
Component/s: finder
Affects Version/s: None
Fix Version/s: 3.6

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works XBEAN-92.patch.txt 2009-09-04 08:05 PM Andreas Veithen 1 kB
Environment: IBM JDK 5

Resolution Date: 10/Sep/09 09:39 PM


 Description  « Hide
With IBM JDK 5, when we try to get the system property java.endorsed.dirs, it returns null. This is a critical issue as it prevents OpenEjb from starting

In UrlSet, the following method will lead to a NullPointerException:

public UrlSet excludeJavaEndorsedDirs() throws MalformedURLException { return excludePaths(System.getProperty("java.endorsed.dirs")); }
This is because the excludePaths() method assumes that the pathString argument is always non-null.
public UrlSet excludePaths(String pathString) throws MalformedURLException {
String[] paths = pathString.split(File.pathSeparator);
UrlSet urlSet = this;
for (String path : paths) { File file = new File(path); urlSet = urlSet.exclude(file); }
return urlSet;
}



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Shawn Jiang added a comment - 01/Jun/09 10:40 AM
Can't recreate this anymore, that's because that

public UrlSet excludeJavaEndorsedDirs() throws MalformedURLException { return excludePaths(System.getProperty("java.endorsed.dirs")); }

has become:

public UrlSet excludeJavaEndorsedDirs() throws MalformedURLException { return excludePaths(System.getProperty("java.endorsed.dirs", "")); }

so that there will be a default "" for endorsed.dirs instead of a null. This JIRA can be closed.


Shawn Jiang added a comment - 01/Jun/09 10:43 AM
Seems I can't closed it. Can anyone help close this JIRA ? Thanks.

Andreas Veithen added a comment - 18/Aug/09 03:27 PM
I think the code is still not correct. I'm using OpenEJB 3.1.1 which depends on xbean-finder-shaded-3.6-r779512.jar. Looking at the byte code of UrlSet#excludeJavaEndorsedDirs(), this version already contains the change described above (usage of System#getProperty(String, String) instead of System#getProperty(String)). It no longer throws a NullPointerException, but excludeJavaEndorsedDirs now removes all URLs with the "file" protocol.

David Blevins added a comment - 04/Sep/09 03:13 AM
Andreas, if you can come up with a quick patch I can get it in. We will be cutting an xbean-finder 3.6 release in the next day or two (beginning of next week at the latest) and then an OpenEJB 3.1.2 right after.

Andreas Veithen added a comment - 04/Sep/09 08:05 PM
Attached a patch that corrects the behavior of excludeJavaEndorsedDirs (and excludeJavaExtDirs). If the corresponding system property is not set, then nothing will be excluded.

David Blevins added a comment - 10/Sep/09 07:30 AM
$ svn ci xbean-finder
Sending xbean-finder/src/main/java/org/apache/xbean/finder/UrlSet.java
Transmitting file data .
Committed revision 813275.

Didn't get this applied for the 3.6 binaries up for vote now. Unsure if we'll see a second roll.