change the way classes are loaded so that classLoaderHasClasses would still work for the classes that are being instrumented and being matched at the same time.

This commit is contained in:
Gary Huang 2018-06-06 16:05:43 -04:00 committed by Gary Huang
parent 42b586badf
commit fdc56c0e13
1 changed files with 6 additions and 8 deletions

View File

@ -142,16 +142,14 @@ public class ClassLoaderMatcher {
if (cache.containsKey(target)) { if (cache.containsKey(target)) {
return cache.get(target); return cache.get(target);
} }
try { for (final String name : names) {
for (final String name : names) { if (target.getResource(Utils.getResourceName(name)) == null) {
Class.forName(name, false, target); cache.put(target, false);
return false;
} }
cache.put(target, true);
return true;
} catch (final ClassNotFoundException e) {
cache.put(target, false);
return false;
} }
cache.put(target, true);
return true;
} }
} }
return false; return false;