8258852: Arrays.asList() for single item could be replaced with List.of()
Reviewed-by: mullan
This commit is contained in:
parent
85bac8c415
commit
7ddc2b5606
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -558,7 +558,7 @@ final class ClientHello {
|
|||||||
cipherSuites = Arrays.asList(sessionSuite,
|
cipherSuites = Arrays.asList(sessionSuite,
|
||||||
CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV);
|
CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV);
|
||||||
} else { // otherwise, use renegotiation_info extension
|
} else { // otherwise, use renegotiation_info extension
|
||||||
cipherSuites = Arrays.asList(sessionSuite);
|
cipherSuites = List.of(sessionSuite);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SSLLogger.isOn &&
|
if (SSLLogger.isOn &&
|
||||||
@ -1076,7 +1076,7 @@ final class ClientHello {
|
|||||||
// Check and launch ClientHello extensions.
|
// Check and launch ClientHello extensions.
|
||||||
SSLExtension[] extTypes = shc.sslConfig.getExclusiveExtensions(
|
SSLExtension[] extTypes = shc.sslConfig.getExclusiveExtensions(
|
||||||
SSLHandshake.CLIENT_HELLO,
|
SSLHandshake.CLIENT_HELLO,
|
||||||
Arrays.asList(SSLExtension.CH_SESSION_TICKET));
|
List.of(SSLExtension.CH_SESSION_TICKET));
|
||||||
clientHello.extensions.consumeOnLoad(shc, extTypes);
|
clientHello.extensions.consumeOnLoad(shc, extTypes);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,7 +29,6 @@ import java.io.IOException;
|
|||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -236,7 +235,7 @@ final class KeyShareExtension {
|
|||||||
List<NamedGroup> namedGroups;
|
List<NamedGroup> namedGroups;
|
||||||
if (chc.serverSelectedNamedGroup != null) {
|
if (chc.serverSelectedNamedGroup != null) {
|
||||||
// Response to HelloRetryRequest
|
// Response to HelloRetryRequest
|
||||||
namedGroups = Arrays.asList(chc.serverSelectedNamedGroup);
|
namedGroups = List.of(chc.serverSelectedNamedGroup);
|
||||||
} else {
|
} else {
|
||||||
namedGroups = chc.clientRequestedNamedGroups;
|
namedGroups = chc.clientRequestedNamedGroups;
|
||||||
if (namedGroups == null || namedGroups.isEmpty()) {
|
if (namedGroups == null || namedGroups.isEmpty()) {
|
||||||
@ -289,7 +288,6 @@ final class KeyShareExtension {
|
|||||||
|
|
||||||
private static byte[] getShare(ClientHandshakeContext chc,
|
private static byte[] getShare(ClientHandshakeContext chc,
|
||||||
NamedGroup ng) {
|
NamedGroup ng) {
|
||||||
byte[] share = null;
|
|
||||||
SSLKeyExchange ke = SSLKeyExchange.valueOf(ng);
|
SSLKeyExchange ke = SSLKeyExchange.valueOf(ng);
|
||||||
if (ke == null) {
|
if (ke == null) {
|
||||||
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
|
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
|
||||||
@ -307,7 +305,7 @@ final class KeyShareExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return share;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -836,12 +834,10 @@ final class KeyShareExtension {
|
|||||||
spec.clientShares.size() == 1) {
|
spec.clientShares.size() == 1) {
|
||||||
int namedGroupId = spec.clientShares.get(0).namedGroupId;
|
int namedGroupId = spec.clientShares.get(0).namedGroupId;
|
||||||
|
|
||||||
byte[] extdata = new byte[] {
|
return new byte[] {
|
||||||
(byte)((namedGroupId >> 8) & 0xFF),
|
(byte)((namedGroupId >> 8) & 0xFF),
|
||||||
(byte)(namedGroupId & 0xFF)
|
(byte)(namedGroupId & 0xFF)
|
||||||
};
|
};
|
||||||
|
|
||||||
return extdata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -30,7 +30,6 @@ import java.security.AccessController;
|
|||||||
import java.security.AlgorithmConstraints;
|
import java.security.AlgorithmConstraints;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -139,8 +138,8 @@ final class SSLConfiguration implements Cloneable {
|
|||||||
this.clientAuthType = ClientAuthType.CLIENT_AUTH_NONE;
|
this.clientAuthType = ClientAuthType.CLIENT_AUTH_NONE;
|
||||||
|
|
||||||
this.identificationProtocol = null;
|
this.identificationProtocol = null;
|
||||||
this.serverNames = Collections.<SNIServerName>emptyList();
|
this.serverNames = Collections.emptyList();
|
||||||
this.sniMatchers = Collections.<SNIMatcher>emptyList();
|
this.sniMatchers = Collections.emptyList();
|
||||||
this.preferLocalCipherSuites = true;
|
this.preferLocalCipherSuites = true;
|
||||||
|
|
||||||
this.applicationProtocols = new String[0];
|
this.applicationProtocols = new String[0];
|
||||||
@ -368,8 +367,7 @@ final class SSLConfiguration implements Cloneable {
|
|||||||
*/
|
*/
|
||||||
SSLExtension[] getEnabledExtensions(
|
SSLExtension[] getEnabledExtensions(
|
||||||
SSLHandshake handshakeType, ProtocolVersion protocolVersion) {
|
SSLHandshake handshakeType, ProtocolVersion protocolVersion) {
|
||||||
return getEnabledExtensions(
|
return getEnabledExtensions(handshakeType, List.of(protocolVersion));
|
||||||
handshakeType, Arrays.asList(protocolVersion));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user