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
David Blevins made changes - 06/Sep/07 08:35 PM
Field Original Value New Value
Assignee David Blevins [ dblevins ]
Repository Revision Date User Message
ASF #573361 Thu Sep 06 20:36:36 UTC 2007 dblevins Compensate for when java.endorsed.dirs is null. Fixes XBEAN-92.
Files Changed
MODIFY /geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/UrlSet.java

Alan Cabrera made changes - 23/Jan/08 09:54 PM
Fix Version/s 3.4 [ 12312938 ]
Dain Sundstrom made changes - 28/Feb/08 10:08 PM
Component/s finder [ 12312182 ]
Guillaume Nodet made changes - 04/Jul/08 07:32 AM
Fix Version/s 3.5 [ 12313293 ]
Fix Version/s 3.4 [ 12312938 ]
Shawn Jiang made changes - 01/Jun/09 10:38 AM
Assignee David Blevins [ dblevins ] Shawn Jiang [ genspring ]
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.

Andreas Veithen made changes - 04/Sep/09 08:05 PM
Attachment XBEAN-92.patch.txt [ 12418666 ]
Repository Revision Date User Message
ASF #813275 Thu Sep 10 07:29:09 UTC 2009 dblevins Patch from Andreas Veithen, for XBEAN-92: UrlSet excludePaths() method throws a nullpointer
which is IBM JDK specific.
Thanks, Andreas!
Files Changed
MODIFY /geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/UrlSet.java

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.


David Jencks made changes - 10/Sep/09 09:39 PM
Resolution Fixed [ 1 ]
Fix Version/s 3.5 [ 12313293 ]
Fix Version/s 3.6 [ 12313981 ]
Status Open [ 1 ] Closed [ 6 ]