RFR: 8048199: Replace anonymous inner classes with lambdas, where applicable, in JNDI [v2]

Daniel Fuchs dfuchs at openjdk.java.net
Mon Apr 26 12:01:32 UTC 2021


On Sun, 25 Apr 2021 09:45:15 GMT, YassinHajaj <github.com+18174180+YassinHajaj at openjdk.org> wrote:

>> src/java.naming/share/classes/com/sun/jndi/ldap/LdapPoolManager.java line 400:
>> 
>>> 398:     private static final String getProperty(final String propName, final String defVal) {
>>> 399:         PrivilegedAction<String> pa = () -> System.getProperty(propName, defVal);
>>> 400:         return AccessController.doPrivileged(pa);
>> 
>> Hmmm... This is not strictly equivalent but will work because java.naming is loaded by the boot loader and has the permission to read all system properties. I guess the code on the left-hand side was written at a time where JNDI was still in a stand-alone library?
>
> @dfuch I noticed the same about the swallowed exception that returns the default value. This wouldn't cause any regression?

As I noted - the SecurityException should never occur so I don't expect this could cause a regression.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3416



More information about the security-dev mailing list