Author: ggregory
Date: Mon Jul 23 15:59:37 2018
New Revision: 1836503
URL: http://svn.apache.org/viewvc?rev=1836503&view=rev
Log:
[VFS-669] org.apache.commons.vfs2.util.CombinedResources.loadResources(String)
should not throw an NPE for the system class loader is null.
Modified:
commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/CombinedResources.java
commons/proper/vfs/trunk/src/changes/changes.xml
Modified:
commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/CombinedResources.java
URL:
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/CombinedResources.java?rev=1836503&r1=1836502&r2=1836503&view=diff
==============================================================================
---
commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/CombinedResources.java
(original)
+++
commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/CombinedResources.java
Mon Jul 23 15:59:37 2018
@@ -74,19 +74,21 @@ public class CombinedResources extends R
if (loader == null) {
loader = ClassLoader.getSystemClassLoader();
}
- resourceName = resourceName.replace('.', '/') + ".properties";
- try {
- final Enumeration<URL> resources =
loader.getResources(resourceName);
- while (resources.hasMoreElements()) {
- final URL resource = resources.nextElement();
- try {
-
properties.load(resource.openConnection().getInputStream());
- } catch (final IOException ignored) {
- // Ignore
+ if (loader != null) {
+ resourceName = resourceName.replace('.', '/') + ".properties";
+ try {
+ final Enumeration<URL> resources =
loader.getResources(resourceName);
+ while (resources.hasMoreElements()) {
+ final URL resource = resources.nextElement();
+ try {
+
properties.load(resource.openConnection().getInputStream());
+ } catch (final IOException ignored) {
+ // Ignore
+ }
}
+ } catch (final IOException ignored) {
+ // Ignore
}
- } catch (final IOException ignored) {
- // Ignore
}
}
Modified: commons/proper/vfs/trunk/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1836503&r1=1836502&r2=1836503&view=diff
==============================================================================
--- commons/proper/vfs/trunk/src/changes/changes.xml (original)
+++ commons/proper/vfs/trunk/src/changes/changes.xml Mon Jul 23 15:59:37 2018
@@ -83,6 +83,9 @@ The <action> type attribute can be add,u
<action issue="VFS-668" dev="ggregory" type="update">
Throw a NPE with a better message when a class loader is null.
</action>
+ <action issue="VFS-669" dev="ggregory" type="fix">
+ org.apache.commons.vfs2.util.CombinedResources.loadResources(String)
should not throw an NPE for the system class loader is null.
+ </action>
</release>
<release version="2.2" date="2017-10-06" description="New features and bug
fix release.">
<action issue="VFS-642" dev="pschumacher" type="update"
due-to="ilangoldfeld">