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 17:06:13 UTC
[8/9] cxf git commit: [CXF-6966] If classloader is null,
don't use it for loading the bundles
[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/63456b2e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/63456b2e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/63456b2e
Branch: refs/heads/3.1.x-fixes
Commit: 63456b2e231e61fb6cb3f12b2a06af27f77a14b5
Parents: 347a54c
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 12:13:28 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/63456b2e/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);
}
}