@@ -402,42 +402,40 @@ private Class<?> defineClass(String name, byte[] classData, ProtectionDomain pro
402402 return defineClass (name , classData , 0 , classData .length , protectionDomain );
403403 }
404404
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 ));
407407 if (resource == null ) {
408408 return null ;
409409 }
410410
411411 CodeSigner [] signers = null ;
412412 int i = name .lastIndexOf ('.' );
413413
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 ) {
426428 String pkgName = name .substring (0 , i );
427429
428430 Package pkg = getPackage (pkgName );
429- // getClassBytes(name);
430- if (entry != null ) {
431- signers = entry .getCodeSigners ();
432- }
433431 if (pkg == null ) {
434432 pkg = definePackage (pkgName , manifest , jarURLConnection .getJarFileURL ());
435433 }
436434 }
437435 }
438- } catch (IOException e ) {
439- e .printStackTrace ();
440436 }
437+ } catch (IOException e ) {
438+ e .printStackTrace ();
441439 }
442440 URL newResource = resource ;
443441
0 commit comments