might actually work, TODO: try
This commit is contained in:
parent
bfa05d16ab
commit
b05141bc33
1 changed files with 7 additions and 9 deletions
|
@ -90,20 +90,18 @@ public class CustomClassloader extends ClassLoader {
|
||||||
final byte[][] data = {null};
|
final byte[][] data = {null};
|
||||||
encryptedClasses.access(accessor -> Loader.classKey.access(classKey -> data[0] = classKey.getValue().decryptByte(accessor.getValue().get(name))));
|
encryptedClasses.access(accessor -> Loader.classKey.access(classKey -> data[0] = classKey.getValue().decryptByte(accessor.getValue().get(name))));
|
||||||
if (data[0] != null) {
|
if (data[0] != null) {
|
||||||
Class<?> definedClass = defineClass(name, data[0], 0, data[0].length);
|
try {
|
||||||
//// TudbuT // using unsafe is a bad idea as it breaks DataKeeper
|
Field b = Unsafe.class.getDeclaredField("theUnsafe");
|
||||||
// try {
|
Unsafe unsafe = (Unsafe)b.get(null);
|
||||||
// Field b = Unsafe.class.getDeclaredField("theUnsafe");
|
Class<?> definedClass = unsafe.defineClass(name, data[0], 0, data[0].length, this, null);
|
||||||
// Unsafe unsafe = (Unsafe)b.get(null);
|
|
||||||
// Class<?> definedClass = unsafe.defineClass(name, data[0], 0, data[0].length, this, null);
|
|
||||||
|
|
||||||
if (definedClass == null) {
|
if (definedClass == null) {
|
||||||
throw new ClassNotFoundException(name);
|
throw new ClassNotFoundException(name);
|
||||||
}
|
}
|
||||||
return definedClass;
|
return definedClass;
|
||||||
// }catch (Exception e){
|
} catch (Exception e){
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
return Launch.classLoader.findClass(name);
|
return Launch.classLoader.findClass(name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue