RFR: 8263497: Clean up sun.security.krb5.PrincipalName::toByteArray [v2]
Aleksey Shipilev
shade at openjdk.java.net
Fri Mar 12 16:35:18 UTC 2021
> SonarCloud actually found this:
> Verify this is the index that was intended; it was already set before.
>
>
> public byte[][] toByteArray() {
> byte[][] result = new byte[nameStrings.length][];
> for (int i = 0; i < nameStrings.length; i++) {
> result[i] = new byte[nameStrings[i].length()]; // <-- here
> result[i] = nameStrings[i].getBytes();
> }
> return result;
> }
>
> `getBytes()` returns the `byte[]` array, there is no need to allocate the array before it.
Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
Copyright update
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/2962/files
- new: https://git.openjdk.java.net/jdk/pull/2962/files/6223ee6f..7e8a3104
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2962&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2962&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/2962.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2962/head:pull/2962
PR: https://git.openjdk.java.net/jdk/pull/2962
More information about the security-dev
mailing list