RFR: JDK-8291509 Minor cleanup could be done in sun.security [v4]

Weijun Wang weijun at openjdk.org
Thu Sep 1 03:47:16 UTC 2022


On Thu, 1 Sep 2022 02:26:48 GMT, Mark Powers <mpowers at openjdk.org> wrote:

>> https://bugs.openjdk.org/browse/JDK-8291509
>
> Mark Powers has updated the pull request incrementally with one additional commit since the last revision:
> 
>   comments from Sean and Max

More comments. Haven't read `ssl`, `util`, and `x509` yet.

src/java.base/share/classes/sun/security/rsa/RSAPadding.java line 335:

> 333:     private byte[] unpadV15(byte[] padded) throws BadPaddingException {
> 334:         int k = 0;
> 335:         boolean bp = padded[k++] != 0;

The original code looks more clear.

src/java.base/share/classes/sun/security/tools/PathList.java line 69:

> 67:         while (st.hasMoreTokens()) {
> 68:             URL url = fileToURL(new File(st.nextToken()));
> 69:             urls[count++] = url;

Please update the javadoc of `fileToURL` to remove `or null if unknown` in `@return`.

src/java.base/share/classes/sun/security/tools/keytool/Main.java line 183:

> 181:     private List<String> weakWarnings = new ArrayList<>();
> 182: 
> 183:     private Set<X509Certificate> trustedCerts = new HashSet<>();

Put all these `final`s in one group.

src/java.base/share/classes/sun/security/tools/keytool/Main.java line 3534:

> 3532:             Object[] source = {alias};
> 3533:             if (otherKeyPass != null) {
> 3534:                 System.err.println(form.format(source));

You can move the line above out as well. It's also the same.

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

PR: https://git.openjdk.org/jdk/pull/9972



More information about the security-dev mailing list