mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8155246: Throw error if default java.security file is missing
Reviewed-by: mullan
This commit is contained in:
parent
e89abb7d2d
commit
9d7c13eb14
4 changed files with 108 additions and 18 deletions
|
@ -47,6 +47,9 @@ import sun.security.jca.*;
|
|||
* implementation-specific location, which is typically the properties file
|
||||
* {@code conf/security/java.security} in the Java installation directory.
|
||||
*
|
||||
* @implNote If the properties file fails to load, the JDK implementation will
|
||||
* throw an unspecified error when initializing the {@code Security} class.
|
||||
*
|
||||
* @author Benjamin Renaud
|
||||
* @since 1.1
|
||||
*/
|
||||
|
@ -183,28 +186,11 @@ public final class Security {
|
|||
}
|
||||
|
||||
if (!loadedProps) {
|
||||
initializeStatic();
|
||||
if (sdebug != null) {
|
||||
sdebug.println("unable to load security properties " +
|
||||
"-- using defaults");
|
||||
}
|
||||
throw new InternalError("java.security file missing");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize to default values, if <java.home>/lib/java.security
|
||||
* is not found.
|
||||
*/
|
||||
private static void initializeStatic() {
|
||||
props.put("security.provider.1", "sun.security.provider.Sun");
|
||||
props.put("security.provider.2", "sun.security.rsa.SunRsaSign");
|
||||
props.put("security.provider.3", "sun.security.ssl.SunJSSE");
|
||||
props.put("security.provider.4", "com.sun.crypto.provider.SunJCE");
|
||||
props.put("security.provider.5", "sun.security.jgss.SunProvider");
|
||||
props.put("security.provider.6", "com.sun.security.sasl.Provider");
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't let anyone instantiate this.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue