Skip to content
Permalink
Browse files
[CXF-5442] Attempt to make sure no references are in place
git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1559257 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
dkulp committed Jan 17, 2014
1 parent 508ed23 commit cb3802f65b13ce4d2ab1e1d4ee84a71ca5562fcc
Showing 1 changed file with 14 additions and 2 deletions.
@@ -69,7 +69,13 @@ public static synchronized void addAuthenticator() {
}

try {
ClassLoader loader = new URLClassLoader(new URL[0], ClassLoader.getSystemClassLoader());
ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
public ClassLoader run() {
return new URLClassLoader(new URL[0], ClassLoader.getSystemClassLoader());
}
}, null);


Method m = ClassLoader.class.getDeclaredMethod("defineClass", String.class,
byte[].class, Integer.TYPE, Integer.TYPE);

@@ -94,9 +100,15 @@ public Boolean run() {
});

}
try {
//clear the acc field that can hold onto the webapp classloader
Field f = loader.getClass().getDeclaredField("acc");
ReflectionUtil.setAccessible(f).set(loader, null);
} catch (Throwable t) {
//ignore
}
} catch (Throwable t) {
//ignore
t.printStackTrace();
}
}
}

0 comments on commit cb3802f

Please sign in to comment.