return invoke("wsimport", jars, os, arguments);
}
private boolean invoke(String toolName, URL[] jars, OutputStream os, String[] arguments) throws Exception {
ClassLoader oldClassLoader = null;
JarFileClassLoader loader = new JarFileClassLoader(null, jars, ClassLoader.getSystemClassLoader(), false, HIDDEN_CLASSES, new String[0]);
if (overrideContextClassLoader) {
oldClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(loader);
}
try {
return invoke(toolName, loader, os, arguments);
} finally {
if (overrideContextClassLoader) {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
try {
loader.destroy();
} catch (Exception e) {
}
}
}