RFR: JDK-8285504 Minor cleanup could be done in javax.net [v2]

Weijun Wang weijun at openjdk.java.net
Tue Apr 26 19:14:03 UTC 2022


On Tue, 26 Apr 2022 00:27:43 GMT, Mark Powers <duke at openjdk.java.net> wrote:

>> https://bugs.openjdk.java.net/browse/JDK-8285504
>> 
>> JDK-8273046 is the umbrella bug for this bug. The changes were too large for a single code review, so it was decided to split into smaller chunks. This is one such chunk: 
>> 
>> open/src/java.base/share/classes/java/net
>
> Mark Powers has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Alan Bateman comments

Looks fine. Some small comments.

src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java line 69:

> 67:         String type;
> 68:         type = AccessController.doPrivileged((PrivilegedAction<String>) () ->
> 69:             Security.getProperty("ssl.KeyManagerFactory.algorithm"));

We can probably use `sun.security.action.GetPropertyAction::privilegedGetProperty`. This is inside `java.base` so that class is always available.

src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java line 96:

> 94:                 s = s.trim();
> 95:                 if (s.isEmpty()) {
> 96:                     s = null;

According to the implementation of `Security::getProperty`. The return value is already trimmed.

src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java line 81:

> 79:         String type;
> 80:         type = AccessController.doPrivileged((PrivilegedAction<String>) () ->
> 81:             Security.getProperty( "ssl.TrustManagerFactory.algorithm"));

Another `GetPropertyAction::privilegedGetProperty` candidate.

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

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



More information about the security-dev mailing list