Skip to content

Commit

Permalink
Slight optimization when looking up System properties (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
radcortez authored Oct 1, 2024
1 parent f0a32ca commit a00e97e
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,17 @@ public Set<String> getPropertyNames() {
}

@Override
public String getValue(String s) {
return doPrivileged((PrivilegedAction<String>) () -> System.getProperty(s));
public String getValue(String propertyName) {
if (System.getSecurityManager() == null) {
return System.getProperty(propertyName);
} else {
return doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty(propertyName);
}
});
}
}

private static Map<String, String> getSystemProperties() {
Expand Down

0 comments on commit a00e97e

Please sign in to comment.