Skip to content

Commit

Permalink
Slight optimization when looking up System properties
Browse files Browse the repository at this point in the history
  • Loading branch information
radcortez committed Oct 1, 2024
1 parent f0a32ca commit bcc39b6
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 bcc39b6

Please sign in to comment.