Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/237#discussion_r69901713
--- Diff:
core/src/main/java/org/apache/brooklyn/util/core/ClassLoaderUtils.java ---
@@ -67,21 +71,33 @@ public ClassLoaderUtils(Object callingObj, @Nullable
ManagementContext mgmt) {
}
public ClassLoaderUtils(Class<?> callingClass) {
- this.callingClass = callingClass;
+ this.classLoader = checkNotNull(callingClass,
"callingClass").getClassLoader();
+ this.entity = null;
+ this.mgmt = null;
+ }
+
+ public ClassLoaderUtils(ClassLoader cl) {
+ this.classLoader = checkNotNull(cl, "classLoader");
this.entity = null;
this.mgmt = null;
}
+ public ClassLoaderUtils(ClassLoader cl, @Nullable ManagementContext
mgmt) {
+ this.classLoader = checkNotNull(cl, "classLoader");
+ this.entity = null;
+ this.mgmt = checkNotNull(mgmt, "mgmt");
+ }
+
public ClassLoaderUtils(Class<?> callingClass, Entity entity) {
- this.callingClass = callingClass;
- this.entity = entity;
+ this.classLoader = checkNotNull(callingClass,
"callingClass").getClassLoader();
+ this.entity = checkNotNull(entity, "entity");
this.mgmt = ((EntityInternal)entity).getManagementContext();
}
public ClassLoaderUtils(Class<?> callingClass, @Nullable
ManagementContext mgmt) {
- this.callingClass = callingClass;
+ this.classLoader = checkNotNull(callingClass,
"callingClass").getClassLoader();
--- End diff --
`getClassLoader` returns `null` for classes on the bootstrap class path.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---