@@ -402,42 +402,40 @@ private Class<?> defineClass(String name, byte[] classData, ProtectionDomain pro
402
402
return defineClass (name , classData , 0 , classData .length , protectionDomain );
403
403
}
404
404
405
- private ProtectionDomain getProtectionDomain (String name ) {
406
- final URL resource = getResource (classResourceName (name ));
405
+ protected ProtectionDomain getProtectionDomain (String name ) {
406
+ URL resource = getOriginalURL (classResourceName (name ));
407
407
if (resource == null ) {
408
408
return null ;
409
409
}
410
410
411
411
CodeSigner [] signers = null ;
412
412
int i = name .lastIndexOf ('.' );
413
413
414
- // TODO avoid explicit net.minecraft comparison. Removing this condition breaks forge atm.
415
- if (i != -1 && !name .startsWith ("net.minecraft." )) {
416
- try {
417
- URLConnection urlConnection = resource .openConnection ();
418
- if (urlConnection instanceof JarURLConnection ) {
419
- final JarURLConnection jarURLConnection = (JarURLConnection )urlConnection ;
420
- JarFile jarFile ;
421
- jarFile = jarURLConnection .getJarFile ();
422
-
423
- if (jarFile != null && jarFile .getManifest () != null ) {
424
- final Manifest manifest = jarFile .getManifest ();
425
- final JarEntry entry = jarFile .getJarEntry (classResourceName (name ));
414
+ try {
415
+ URLConnection urlConnection = resource .openConnection ();
416
+ if (urlConnection instanceof JarURLConnection ) {
417
+ final JarURLConnection jarURLConnection = (JarURLConnection )urlConnection ;
418
+ JarFile jarFile ;
419
+ jarFile = jarURLConnection .getJarFile ();
420
+
421
+ if (jarFile != null && jarFile .getManifest () != null ) {
422
+ final Manifest manifest = jarFile .getManifest ();
423
+ final JarEntry entry = jarFile .getJarEntry (classResourceName (name ));
424
+ if (entry != null ) {
425
+ signers = entry .getCodeSigners ();
426
+ }
427
+ if (i != -1 ) {
426
428
String pkgName = name .substring (0 , i );
427
429
428
430
Package pkg = getPackage (pkgName );
429
- // getClassBytes(name);
430
- if (entry != null ) {
431
- signers = entry .getCodeSigners ();
432
- }
433
431
if (pkg == null ) {
434
432
pkg = definePackage (pkgName , manifest , jarURLConnection .getJarFileURL ());
435
433
}
436
434
}
437
435
}
438
- } catch (IOException e ) {
439
- e .printStackTrace ();
440
436
}
437
+ } catch (IOException e ) {
438
+ e .printStackTrace ();
441
439
}
442
440
URL newResource = resource ;
443
441
0 commit comments