On Fri, 12 Mar 2021 09:22:40 GMT, Aleksey Shipilev <[email protected]> wrote:
> 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.
This pull request has now been integrated.
Changeset: 06383033
Author: Aleksey Shipilev <[email protected]>
URL: https://git.openjdk.java.net/jdk/commit/06383033
Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod
8263497: Clean up sun.security.krb5.PrincipalName::toByteArray
Reviewed-by: weijun
-------------
PR: https://git.openjdk.java.net/jdk/pull/2962