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

David Holmes david.holmes at oracle.com
Sat Feb 24 06:18:58 UTC 2018


Looks good.

Is there an existing test that caught this?

Thanks,
David

On 24/02/2018 7:57 AM, mandy chung wrote:
> 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