How could I fix sonnar issue delete dynamic class loading
protected Class registerAndLoadClass(String className) throws ClassNotFoundException {
Class definedClass = classLoader.loadClass(className);
addDefinedClass(definedClass, true, null);
return definedClass;
}
I tried
protected Class registerAndLoadClass(String className) throws ClassNotFoundException {
Class definedClass = null;
try {
definedClass = (Class) classLoader.getClass()
.getDeclaredMethod("loadClass", String.class, boolean.class)
.invoke(null, className);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
addDefinedClass(definedClass, true, null);
return definedClass;
}
But it send NPE, when I'm trying to use it.
Aucun commentaire:
Enregistrer un commentaire