aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2016-03-21 21:32:38 +0200
committerDecebal Suiu <decebal.suiu@gmail.com>2016-03-21 21:32:38 +0200
commita866af82241692825139e57508a93366e0ca85a6 (patch)
treebf9805b05aeab1d405342e9b5fedb1a43025a087
parent9fd95e8f62c86141cd1838749c741423f5091987 (diff)
downloadpf4j-a866af82241692825139e57508a93366e0ca85a6.tar.gz
pf4j-a866af82241692825139e57508a93366e0ca85a6.zip
Try to create a defense for the issues similar with #97
-rw-r--r--pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java b/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java
index 3cefea9..efa025b 100644
--- a/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java
+++ b/pf4j/src/main/java/ro/fortsoft/pf4j/AbstractExtensionFinder.java
@@ -44,6 +44,7 @@ public abstract class AbstractExtensionFinder implements ExtensionFinder, Plugin
public abstract Map<String, Set<String>> readClasspathStorages();
@Override
+ @SuppressWarnings("unchecked")
public <T> List<ExtensionWrapper<T>> find(Class<T> type) {
log.debug("Finding extensions for extension point '{}'", type.getName());
Map<String, Set<String>> entries = getEntries();
@@ -85,7 +86,12 @@ public abstract class AbstractExtensionFinder implements ExtensionFinder, Plugin
result.add(extensionWrapper);
log.debug("Added extension '{}' with ordinal {}", className, ordinal);
} else {
- log.debug("'{}' is not an extension for extension point '{}'", className, type.getName());
+ log.warn("'{}' is not an extension for extension point '{}'", className, type.getName());
+ ClassLoader classLoader1 = type.getClassLoader();
+ ClassLoader classLoader2 = extensionClass.getClassLoader();
+ if (!classLoader1.equals(classLoader2)) {
+ log.warn("Different class loaders: '{}' and '{}'", classLoader1, classLoader2);
+ }
}
} catch (ClassNotFoundException e) {
log.error(e.getMessage(), e);