You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2016/07/22 16:12:44 UTC
cxf git commit: [CXF-6966] If classloader is null,
don't use it for loading the bundles
Repository: cxf
Updated Branches:
refs/heads/master b06f6e2cb -> 949df02a4
[CXF-6966] If classloader is null, don't use it for loading the bundles
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/949df02a
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/949df02a
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/949df02a
Branch: refs/heads/master
Commit: 949df02a48ca3558786b7fc96de04121e906406a
Parents: b06f6e2
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Jul 22 11:31:05 2016 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Jul 22 11:31:27 2016 -0400
----------------------------------------------------------------------
.../org/apache/cxf/common/i18n/BundleUtils.java | 24 ++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/949df02a/core/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java b/core/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
index 9aedfcf..5fdd3b4 100644
--- a/core/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
@@ -77,13 +77,21 @@ public final class BundleUtils {
public static ResourceBundle getBundle(Class<?> cls) {
try {
+ ClassLoader loader = cls.getClassLoader();
+ if (loader == null) {
+ return ResourceBundle.getBundle(getBundleName(cls), Locale.getDefault());
+ }
return ResourceBundle.getBundle(getBundleName(cls),
Locale.getDefault(),
- cls.getClassLoader());
+ loader);
} catch (MissingResourceException ex) {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ if (loader == null) {
+ return ResourceBundle.getBundle(getBundleName(cls), Locale.getDefault());
+ }
return ResourceBundle.getBundle(getBundleName(cls),
Locale.getDefault(),
- Thread.currentThread().getContextClassLoader());
+ loader);
}
}
@@ -98,13 +106,21 @@ public final class BundleUtils {
*/
public static ResourceBundle getBundle(Class<?> cls, String name) {
try {
+ ClassLoader loader = cls.getClassLoader();
+ if (loader == null) {
+ return ResourceBundle.getBundle(getBundleName(cls, name), Locale.getDefault());
+ }
return ResourceBundle.getBundle(getBundleName(cls, name),
Locale.getDefault(),
- cls.getClassLoader());
+ loader);
} catch (MissingResourceException ex) {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ if (loader == null) {
+ return ResourceBundle.getBundle(getBundleName(cls, name), Locale.getDefault());
+ }
return ResourceBundle.getBundle(getBundleName(cls, name),
Locale.getDefault(),
- Thread.currentThread().getContextClassLoader());
+ loader);
}
}