8212117: Class.forName may return a reference to a loaded but not linked Class

Reviewed-by: dholmes, mchung
This commit is contained in:
Brent Christian 2019-09-09 11:04:04 -07:00
parent 10e4fd4b95
commit a4613d4a8f
13 changed files with 342 additions and 16 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -62,6 +62,7 @@ import java.nio.charset.Charset;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.AccessControlException;
import java.text.Normalizer;
import java.text.MessageFormat;
import java.util.ArrayList;
@ -724,6 +725,9 @@ public final class LauncherHelper {
} catch (LinkageError le) {
abort(null, "java.launcher.module.error3", mainClass, m.getName(),
le.getClass().getName() + ": " + le.getLocalizedMessage());
} catch (AccessControlException ace) {
abort(ace, "java.launcher.module.error5", mainClass, m.getName(),
ace.getClass().getName(), ace.getLocalizedMessage());
}
if (c == null) {
abort(null, "java.launcher.module.error2", mainClass, mainModule);
@ -780,6 +784,9 @@ public final class LauncherHelper {
} catch (LinkageError le) {
abort(le, "java.launcher.cls.error6", cn,
le.getClass().getName() + ": " + le.getLocalizedMessage());
} catch (AccessControlException ace) {
abort(ace, "java.launcher.cls.error7", cn,
ace.getClass().getName(), ace.getLocalizedMessage());
}
return mainClass;
}