8224589: Improve startup behavior of SecurityProperties

Reviewed-by: alanb
This commit is contained in:
Claes Redestad 2019-05-22 13:19:04 +02:00
parent 12b2a50bb2
commit d3ccef96e5

View file

@ -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;
}
}
/**