Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8258852: Arrays.asList() for single item could be replaced with List.…
…of()

Reviewed-by: mullan
  • Loading branch information
XueleiFan committed Jan 5, 2021
1 parent 85bac8c commit 7ddc2b5606cd5353a3c25dde476ff0e6ccc2ed23
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -558,7 +558,7 @@ public byte[] produce(ConnectionContext context) throws IOException {
cipherSuites = Arrays.asList(sessionSuite,
CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV);
} else { // otherwise, use renegotiation_info extension
cipherSuites = Arrays.asList(sessionSuite);
cipherSuites = List.of(sessionSuite);
}

if (SSLLogger.isOn &&
@@ -1076,7 +1076,7 @@ public void consume(ConnectionContext context,
// Check and launch ClientHello extensions.
SSLExtension[] extTypes = shc.sslConfig.getExclusiveExtensions(
SSLHandshake.CLIENT_HELLO,
Arrays.asList(SSLExtension.CH_SESSION_TICKET));
List.of(SSLExtension.CH_SESSION_TICKET));
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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.LinkedList;
@@ -236,7 +235,7 @@ public byte[] produce(ConnectionContext context,
List<NamedGroup> namedGroups;
if (chc.serverSelectedNamedGroup != null) {
// Response to HelloRetryRequest
namedGroups = Arrays.asList(chc.serverSelectedNamedGroup);
namedGroups = List.of(chc.serverSelectedNamedGroup);
} else {
namedGroups = chc.clientRequestedNamedGroups;
if (namedGroups == null || namedGroups.isEmpty()) {
@@ -289,7 +288,6 @@ public byte[] produce(ConnectionContext context,

private static byte[] getShare(ClientHandshakeContext chc,
NamedGroup ng) {
byte[] share = null;
SSLKeyExchange ke = SSLKeyExchange.valueOf(ng);
if (ke == null) {
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
@@ -307,7 +305,7 @@ private static byte[] getShare(ClientHandshakeContext chc,
}
}
}
return share;
return null;
}
}

@@ -836,12 +834,10 @@ public byte[] produce(ConnectionContext context,
spec.clientShares.size() == 1) {
int namedGroupId = spec.clientShares.get(0).namedGroupId;

byte[] extdata = new byte[] {
return new byte[] {
(byte)((namedGroupId >> 8) & 0xFF),
(byte)(namedGroupId & 0xFF)
};

return extdata;
}

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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
import java.security.AlgorithmConstraints;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -139,8 +138,8 @@ final class SSLConfiguration implements Cloneable {
this.clientAuthType = ClientAuthType.CLIENT_AUTH_NONE;

this.identificationProtocol = null;
this.serverNames = Collections.<SNIServerName>emptyList();
this.sniMatchers = Collections.<SNIMatcher>emptyList();
this.serverNames = Collections.emptyList();
this.sniMatchers = Collections.emptyList();
this.preferLocalCipherSuites = true;

this.applicationProtocols = new String[0];
@@ -368,8 +367,7 @@ SSLExtension[] getExclusiveExtensions(SSLHandshake handshakeType,
*/
SSLExtension[] getEnabledExtensions(
SSLHandshake handshakeType, ProtocolVersion protocolVersion) {
return getEnabledExtensions(
handshakeType, Arrays.asList(protocolVersion));
return getEnabledExtensions(handshakeType, List.of(protocolVersion));
}

/**

0 comments on commit 7ddc2b5

Please sign in to comment.