[11] RFR JDK-8198653: ClassLoader::getSystemClassLoader throws InternalError when called after shutdown

mandy chung mandy.chung at oracle.com
Fri Feb 23 21:57:32 UTC 2018


JDK-8198249 added a new shutdown VM initLevel.  ClassLoader::getSystemClassLoader
should be updated to handle the new case.  I checked all other callers of
VM::initLevel and no other place needs update.

Thanks
Mandy

diff --git a/src/java.base/share/classes/java/lang/ClassLoader.java b/src/java.base/share/classes/java/lang/ClassLoader.java
--- a/src/java.base/share/classes/java/lang/ClassLoader.java
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java
@@ -1922,7 +1922,7 @@
              case 3:
                  String msg = "getSystemClassLoader cannot be called during the system class loader instantiation";
                  throw new IllegalStateException(msg);
-            case 4:
+            default:
                  // system fully initialized
                  assert VM.isBooted() && scl != null;
                  SecurityManager sm = System.getSecurityManager();
@@ -1930,8 +1930,6 @@
                      checkClassLoaderPermission(scl, Reflection.getCallerClass());
                  }
                  return scl;
-            default:
-                throw new InternalError("should not reach here");
          }
      }



More information about the core-libs-dev mailing list