8258804: Collection.toArray() should use empty array

Reviewed-by: mullan
This commit is contained in:
Xue-Lei Andrew Fan 2020-12-22 18:12:37 +00:00
parent 9e463d1a88
commit 39e03a0b2c
2 changed files with 3 additions and 3 deletions

View file

@ -851,7 +851,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
} else {
// Use the customized TLS protocols.
candidates =
refactored.toArray(new ProtocolVersion[refactored.size()]);
refactored.toArray(new ProtocolVersion[0]);
}
return getAvailableProtocols(candidates);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -424,6 +424,6 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
}
}
}
return list.toArray(new X500Principal[list.size()]);
return list.toArray(new X500Principal[0]);
}
}