mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8224589: Improve startup behavior of SecurityProperties
Reviewed-by: alanb
This commit is contained in:
parent
12b2a50bb2
commit
d3ccef96e5
1 changed files with 14 additions and 9 deletions
|
@ -43,15 +43,20 @@ public class SecurityProperties {
|
|||
* @return the value of the system or security property
|
||||
*/
|
||||
public static String privilegedGetOverridable(String propName) {
|
||||
return AccessController.doPrivileged((PrivilegedAction<String>)
|
||||
() -> {
|
||||
String val = System.getProperty(propName);
|
||||
if (val == null) {
|
||||
return Security.getProperty(propName);
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
});
|
||||
if (System.getSecurityManager() == null) {
|
||||
return getOverridableProperty(propName);
|
||||
} else {
|
||||
return AccessController.doPrivileged((PrivilegedAction<String>) () -> getOverridableProperty(propName));
|
||||
}
|
||||
}
|
||||
|
||||
private static String getOverridableProperty(String propName) {
|
||||
String val = System.getProperty(propName);
|
||||
if (val == null) {
|
||||
return Security.getProperty(propName);
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue