Skip to content

Commit b72de3c

Browse files
committedJan 11, 2021
8259385: Cleanup unused assignment
Reviewed-by: attila
1 parent 9154f64 commit b72de3c

18 files changed

+70
-79
lines changed
 

‎src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ private CTCertStatusResponseProducer() {
11031103
public byte[] produce(ConnectionContext context,
11041104
HandshakeMessage message) throws IOException {
11051105
ServerHandshakeContext shc = (ServerHandshakeContext)context;
1106-
byte[] producedData = null;
1106+
byte[] producedData;
11071107

11081108
// Stapling needs to be active and have valid data to proceed
11091109
if (shc.stapleParams == null) {

‎src/java.base/share/classes/sun/security/ssl/CertificateStatus.java

+21-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -85,8 +85,8 @@ final class CertificateStatus {
8585
static final class CertificateStatusMessage extends HandshakeMessage {
8686

8787
final CertStatusRequestType statusType;
88-
int encodedResponsesLen = 0;
89-
int messageLength = -1;
88+
final int encodedResponsesLen;
89+
final int messageLength;
9090
final List<byte[]> encodedResponses = new ArrayList<>();
9191

9292
CertificateStatusMessage(HandshakeContext handshakeContext) {
@@ -114,6 +114,7 @@ static final class CertificateStatusMessage extends HandshakeMessage {
114114
// Walk the certificate list and add the correct encoded responses
115115
// to the encoded responses list
116116
statusType = stapleParams.statReqType;
117+
int encodedLen = 0;
117118
if (statusType == CertStatusRequestType.OCSP) {
118119
// Just worry about the first cert in the chain
119120
byte[] resp = stapleParams.responseMap.get(certChain[0]);
@@ -124,22 +125,23 @@ static final class CertificateStatusMessage extends HandshakeMessage {
124125
resp = new byte[0];
125126
}
126127
encodedResponses.add(resp);
127-
encodedResponsesLen += resp.length + 3;
128+
encodedLen += resp.length + 3;
128129
} else if (statusType == CertStatusRequestType.OCSP_MULTI) {
129130
for (X509Certificate cert : certChain) {
130131
byte[] resp = stapleParams.responseMap.get(cert);
131132
if (resp == null) {
132133
resp = new byte[0];
133134
}
134135
encodedResponses.add(resp);
135-
encodedResponsesLen += resp.length + 3;
136+
encodedLen += resp.length + 3;
136137
}
137138
} else {
138139
throw new IllegalArgumentException(
139140
"Unsupported StatusResponseType: " + statusType);
140141
}
141142

142-
messageLength = messageLength();
143+
encodedResponsesLen = encodedLen;
144+
messageLength = messageLength(statusType, encodedResponsesLen);
143145
}
144146

145147
CertificateStatusMessage(HandshakeContext handshakeContext,
@@ -182,7 +184,18 @@ static final class CertificateStatusMessage extends HandshakeMessage {
182184
Alert.HANDSHAKE_FAILURE,
183185
"Unsupported StatusResponseType: " + statusType);
184186
}
185-
messageLength = messageLength();
187+
messageLength = messageLength(statusType, encodedResponsesLen);
188+
}
189+
190+
private static int messageLength(
191+
CertStatusRequestType statusType, int encodedResponsesLen) {
192+
if (statusType == CertStatusRequestType.OCSP) {
193+
return 1 + encodedResponsesLen;
194+
} else if (statusType == CertStatusRequestType.OCSP_MULTI) {
195+
return 4 + encodedResponsesLen;
196+
}
197+
198+
return -1;
186199
}
187200

188201
@Override
@@ -192,17 +205,6 @@ public SSLHandshake handshakeType() {
192205

193206
@Override
194207
public int messageLength() {
195-
int len = 1;
196-
197-
if (messageLength == -1) {
198-
if (statusType == CertStatusRequestType.OCSP) {
199-
len += encodedResponsesLen;
200-
} else if (statusType == CertStatusRequestType.OCSP_MULTI) {
201-
len += 3 + encodedResponsesLen;
202-
}
203-
messageLength = len;
204-
}
205-
206208
return messageLength;
207209
}
208210

@@ -214,11 +216,7 @@ public void send(HandshakeOutStream s) throws IOException {
214216
} else if (statusType == CertStatusRequestType.OCSP_MULTI) {
215217
s.putInt24(encodedResponsesLen);
216218
for (byte[] respBytes : encodedResponses) {
217-
if (respBytes != null) {
218-
s.putBytes24(respBytes);
219-
} else {
220-
s.putBytes24(null);
221-
}
219+
s.putBytes24(respBytes);
222220
}
223221
} else {
224222
// It is highly unlikely that we will fall into this section

‎src/java.base/share/classes/sun/security/ssl/CertificateVerify.java

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -74,15 +74,15 @@ static final class S30CertificateVerifyMessage extends HandshakeMessage {
7474

7575
// This happens in client side only.
7676
ClientHandshakeContext chc = (ClientHandshakeContext)context;
77-
byte[] temproary = null;
77+
byte[] temporary;
7878
String algorithm = x509Possession.popPrivateKey.getAlgorithm();
7979
try {
8080
Signature signer =
8181
getSignature(algorithm, x509Possession.popPrivateKey);
8282
byte[] hashes = chc.handshakeHash.digest(algorithm,
8383
chc.handshakeSession.getMasterSecret());
8484
signer.update(hashes);
85-
temproary = signer.sign();
85+
temporary = signer.sign();
8686
} catch (NoSuchAlgorithmException nsae) {
8787
throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
8888
"Unsupported signature algorithm (" + algorithm +
@@ -92,7 +92,7 @@ static final class S30CertificateVerifyMessage extends HandshakeMessage {
9292
"Cannot produce CertificateVerify signature", gse);
9393
}
9494

95-
this.signature = temproary;
95+
this.signature = temporary;
9696
}
9797

9898
S30CertificateVerifyMessage(HandshakeContext context,
@@ -194,7 +194,7 @@ public String toString() {
194194
*/
195195
private static Signature getSignature(String algorithm,
196196
Key key) throws GeneralSecurityException {
197-
Signature signer = null;
197+
Signature signer;
198198
switch (algorithm) {
199199
case "RSA":
200200
signer = Signature.getInstance(JsseJce.SIGNATURE_RAWRSA);
@@ -330,14 +330,14 @@ static final class T10CertificateVerifyMessage extends HandshakeMessage {
330330

331331
// This happens in client side only.
332332
ClientHandshakeContext chc = (ClientHandshakeContext)context;
333-
byte[] temproary = null;
333+
byte[] temporary;
334334
String algorithm = x509Possession.popPrivateKey.getAlgorithm();
335335
try {
336336
Signature signer =
337337
getSignature(algorithm, x509Possession.popPrivateKey);
338338
byte[] hashes = chc.handshakeHash.digest(algorithm);
339339
signer.update(hashes);
340-
temproary = signer.sign();
340+
temporary = signer.sign();
341341
} catch (NoSuchAlgorithmException nsae) {
342342
throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
343343
"Unsupported signature algorithm (" + algorithm +
@@ -347,7 +347,7 @@ static final class T10CertificateVerifyMessage extends HandshakeMessage {
347347
"Cannot produce CertificateVerify signature", gse);
348348
}
349349

350-
this.signature = temproary;
350+
this.signature = temporary;
351351
}
352352

353353
T10CertificateVerifyMessage(HandshakeContext context,
@@ -448,7 +448,7 @@ public String toString() {
448448
*/
449449
private static Signature getSignature(String algorithm,
450450
Key key) throws GeneralSecurityException {
451-
Signature signer = null;
451+
Signature signer;
452452
switch (algorithm) {
453453
case "RSA":
454454
signer = Signature.getInstance(JsseJce.SIGNATURE_RAWRSA);
@@ -605,17 +605,17 @@ static final class T12CertificateVerifyMessage extends HandshakeMessage {
605605
}
606606

607607
this.signatureScheme = schemeAndSigner.getKey();
608-
byte[] temproary = null;
608+
byte[] temporary;
609609
try {
610610
Signature signer = schemeAndSigner.getValue();
611611
signer.update(chc.handshakeHash.archived());
612-
temproary = signer.sign();
612+
temporary = signer.sign();
613613
} catch (SignatureException ikse) {
614614
throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
615615
"Cannot produce CertificateVerify signature", ikse);
616616
}
617617

618-
this.signature = temproary;
618+
this.signature = temporary;
619619
}
620620

621621
T12CertificateVerifyMessage(HandshakeContext handshakeContext,
@@ -930,17 +930,17 @@ static final class T13CertificateVerifyMessage extends HandshakeMessage {
930930
serverSignHead.length, hashValue.length);
931931
}
932932

933-
byte[] temproary = null;
933+
byte[] temporary;
934934
try {
935935
Signature signer = schemeAndSigner.getValue();
936936
signer.update(contentCovered);
937-
temproary = signer.sign();
937+
temporary = signer.sign();
938938
} catch (SignatureException ikse) {
939939
throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
940940
"Cannot produce CertificateVerify signature", ikse);
941941
}
942942

943-
this.signature = temproary;
943+
this.signature = temporary;
944944
}
945945

946946
T13CertificateVerifyMessage(HandshakeContext context,

‎src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class DHServerKeyExchangeMessage extends HandshakeMessage {
123123
} else {
124124
useExplicitSigAlgorithm =
125125
shc.negotiatedProtocol.useTLS12PlusSpec();
126-
Signature signer = null;
126+
Signature signer;
127127
if (useExplicitSigAlgorithm) {
128128
Map.Entry<SignatureScheme, Signature> schemeAndSigner =
129129
SignatureScheme.getSignerOfPreferableAlgorithm(
@@ -155,7 +155,7 @@ class DHServerKeyExchangeMessage extends HandshakeMessage {
155155
}
156156
}
157157

158-
byte[] signature = null;
158+
byte[] signature;
159159
try {
160160
updateSignature(signer, shc.clientHelloRandom.randomBytes,
161161
shc.serverHelloRandom.randomBytes);
@@ -415,7 +415,7 @@ public String toString() {
415415

416416
private static Signature getSignature(String keyAlgorithm,
417417
Key key) throws NoSuchAlgorithmException, InvalidKeyException {
418-
Signature signer = null;
418+
Signature signer;
419419
switch (keyAlgorithm) {
420420
case "DSA":
421421
signer = Signature.getInstance(JsseJce.SIGNATURE_DSA);

‎src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ private Plaintext acquireCachedMessage() throws SSLProtocolException {
11181118
bufferedFragments.remove(rFrag); // popup the fragment
11191119

11201120
ByteBuffer fragment = ByteBuffer.wrap(rFrag.fragment);
1121-
ByteBuffer plaintextFragment = null;
1121+
ByteBuffer plaintextFragment;
11221122
try {
11231123
Plaintext plaintext = readCipher.decrypt(
11241124
rFrag.contentType, fragment, rFrag.recordEnS);

‎src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java

-2
Original file line numberDiff line numberDiff line change
@@ -367,15 +367,13 @@ public byte[] produce(ConnectionContext context,
367367

368368
SSLCredentials sslCredentials = null;
369369
NamedGroup ng = null;
370-
PublicKey publicKey = null;
371370

372371
// Find a good EC/XEC credential to use, determine the
373372
// NamedGroup to use for creating Possessions/Credentials/Keys.
374373
for (SSLCredentials cd : chc.handshakeCredentials) {
375374
if (cd instanceof NamedGroupCredentials) {
376375
NamedGroupCredentials creds = (NamedGroupCredentials)cd;
377376
ng = creds.getNamedGroup();
378-
publicKey = creds.getPublicKey();
379377
sslCredentials = cd;
380378
break;
381379
}

‎src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class ECDHServerKeyExchangeMessage extends HandshakeMessage {
133133
} else {
134134
useExplicitSigAlgorithm =
135135
shc.negotiatedProtocol.useTLS12PlusSpec();
136-
Signature signer = null;
136+
Signature signer;
137137
if (useExplicitSigAlgorithm) {
138138
Map.Entry<SignatureScheme, Signature> schemeAndSigner =
139139
SignatureScheme.getSignerOfPreferableAlgorithm(
@@ -165,7 +165,7 @@ class ECDHServerKeyExchangeMessage extends HandshakeMessage {
165165
}
166166
}
167167

168-
byte[] signature = null;
168+
byte[] signature;
169169
try {
170170
updateSignature(signer, shc.clientHelloRandom.randomBytes,
171171
shc.serverHelloRandom.randomBytes,
@@ -419,7 +419,7 @@ public String toString() {
419419

420420
private static Signature getSignature(String keyAlgorithm,
421421
Key key) throws NoSuchAlgorithmException, InvalidKeyException {
422-
Signature signer = null;
422+
Signature signer;
423423
switch (keyAlgorithm) {
424424
case "EC":
425425
signer = Signature.getInstance(JsseJce.SIGNATURE_ECDSA);

‎src/java.base/share/classes/sun/security/ssl/Finished.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private static final class FinishedMessage extends HandshakeMessage {
7979
VerifyDataScheme vds =
8080
VerifyDataScheme.valueOf(context.negotiatedProtocol);
8181

82-
byte[] vd = null;
82+
byte[] vd;
8383
try {
8484
vd = vds.createVerifyData(context, false);
8585
} catch (IOException ioe) {

‎src/java.base/share/classes/sun/security/ssl/OutputRecord.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ private long t13Encrypt(
486486
}
487487

488488
// use the right TLSCiphertext.opaque_type and legacy_record_version
489-
ProtocolVersion pv = protocolVersion;
489+
ProtocolVersion pv;
490490
if (!encCipher.isNullCipher()) {
491491
pv = ProtocolVersion.TLS12;
492492
contentType = ContentType.APPLICATION_DATA.id;

‎src/java.base/share/classes/sun/security/ssl/RSAKeyExchange.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -135,7 +135,7 @@ static RSAPremasterSecret decode(ServerHandshakeContext shc,
135135
byte[] encrypted) throws GeneralSecurityException {
136136

137137
byte[] encoded = null;
138-
boolean needFailover = false;
138+
boolean needFailover;
139139
Cipher cipher = Cipher.getInstance(JsseJce.CIPHER_RSA_PKCS1);
140140
try {
141141
// Try UNWRAP_MODE mode firstly.

‎src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@ private RSAServerKeyExchangeMessage(HandshakeContext handshakeContext,
8383
RSAPublicKeySpec spec = JsseJce.getRSAPublicKeySpec(publicKey);
8484
this.modulus = Utilities.toByteArray(spec.getModulus());
8585
this.exponent = Utilities.toByteArray(spec.getPublicExponent());
86-
byte[] signature = null;
86+
byte[] signature;
8787
try {
8888
Signature signer = RSASignature.getInstance();
8989
signer.initSign(x509Possession.popPrivateKey,

‎src/java.base/share/classes/sun/security/ssl/SSLCipher.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -2200,7 +2200,7 @@ public Plaintext decrypt(byte contentType, ByteBuffer bb,
22002200

22012201
// DON'T decrypt the nonce_explicit for AEAD mode. The buffer
22022202
// position has moved out of the nonce_explicit range.
2203-
int len = bb.remaining();
2203+
int len;
22042204
int pos = bb.position();
22052205
ByteBuffer dup = bb.duplicate();
22062206
try {
@@ -2320,7 +2320,6 @@ public int encrypt(byte contentType,
23202320
cipher.updateAAD(aad);
23212321

23222322
// DON'T encrypt the nonce for AEAD mode.
2323-
int len = bb.remaining();
23242323
int pos = bb.position();
23252324
if (SSLLogger.isOn && SSLLogger.isOn("plaintext")) {
23262325
SSLLogger.fine(
@@ -2339,6 +2338,7 @@ public int encrypt(byte contentType,
23392338
bb.limit(pos + outputSize);
23402339
}
23412340

2341+
int len;
23422342
try {
23432343
len = cipher.doFinal(dup, bb);
23442344
} catch (IllegalBlockSizeException |
@@ -2470,7 +2470,7 @@ public Plaintext decrypt(byte contentType, ByteBuffer bb,
24702470
contentType, bb.remaining(), sn);
24712471
cipher.updateAAD(aad);
24722472

2473-
int len = bb.remaining();
2473+
int len;
24742474
int pos = bb.position();
24752475
ByteBuffer dup = bb.duplicate();
24762476
try {
@@ -2602,7 +2602,6 @@ public int encrypt(byte contentType,
26022602
contentType, outputSize, sn);
26032603
cipher.updateAAD(aad);
26042604

2605-
int len = bb.remaining();
26062605
int pos = bb.position();
26072606
if (SSLLogger.isOn && SSLLogger.isOn("plaintext")) {
26082607
SSLLogger.fine(
@@ -2620,6 +2619,7 @@ public int encrypt(byte contentType,
26202619
bb.limit(pos + outputSize);
26212620
}
26222621

2622+
int len;
26232623
try {
26242624
len = cipher.doFinal(dup, bb);
26252625
} catch (IllegalBlockSizeException |

‎src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1023,9 +1023,7 @@ public FileInputStream run() throws Exception {
10231023
passwd = defaultKeyStorePassword.toCharArray();
10241024
}
10251025

1026-
/**
1027-
* Try to initialize key store.
1028-
*/
1026+
// Try to initialize key store.
10291027
if ((defaultKeyStoreType.length()) != 0) {
10301028
if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) {
10311029
SSLLogger.finest("init keystore");
@@ -1304,7 +1302,7 @@ private static class CustomizedDTLSContext extends AbstractDTLSContext {
13041302
private static final List<CipherSuite> clientDefaultCipherSuites;
13051303
private static final List<CipherSuite> serverDefaultCipherSuites;
13061304

1307-
private static IllegalArgumentException reservedException = null;
1305+
private static IllegalArgumentException reservedException;
13081306

13091307
// Don't want a java.lang.LinkageError for illegal system property.
13101308
//

‎src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -75,8 +75,7 @@ private int bytesInCompletePacket(ByteBuffer packet) throws SSLException {
7575

7676
int pos = packet.position();
7777
byte byteZero = packet.get(pos);
78-
79-
int len = 0;
78+
int len;
8079

8180
/*
8281
* If we have already verified previous packets, we can

‎src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,6 @@ final class SSLSessionImpl extends ExtendedSSLSession {
307307
*/
308308

309309
SSLSessionImpl(HandshakeContext hc, ByteBuffer buf) throws IOException {
310-
int i = 0;
311-
byte[] b;
312-
313310
boundValues = new ConcurrentHashMap<>();
314311
this.protocolVersion =
315312
ProtocolVersion.valueOf(Short.toUnsignedInt(buf.getShort()));
@@ -323,7 +320,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
323320

324321
// Local Supported signature algorithms
325322
ArrayList<SignatureScheme> list = new ArrayList<>();
326-
i = Byte.toUnsignedInt(buf.get());
323+
int i = Byte.toUnsignedInt(buf.get());
327324
while (i-- > 0) {
328325
list.add(SignatureScheme.valueOf(
329326
Short.toUnsignedInt(buf.getShort())));
@@ -340,6 +337,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
340337
this.peerSupportedSignAlgs = Collections.unmodifiableCollection(list);
341338

342339
// PSK
340+
byte[] b;
343341
i = Short.toUnsignedInt(buf.getShort());
344342
if (i > 0) {
345343
b = new byte[i];

‎src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2020, Azul Systems, Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -74,7 +74,7 @@ int bytesInCompletePacket() throws IOException {
7474
}
7575

7676
byte byteZero = header[0];
77-
int len = 0;
77+
int len;
7878

7979
/*
8080
* If we have already verified previous packets, we can

‎src/java.base/share/classes/sun/security/ssl/SSLTransport.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -104,7 +104,7 @@ static Plaintext decode(TransportContext context,
104104
ByteBuffer[] srcs, int srcsOffset, int srcsLength,
105105
ByteBuffer[] dsts, int dstsOffset, int dstsLength) throws IOException {
106106

107-
Plaintext[] plaintexts = null;
107+
Plaintext[] plaintexts;
108108
try {
109109
plaintexts =
110110
context.inputRecord.decode(srcs, srcsOffset, srcsLength);

‎src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -156,7 +156,7 @@ private Validator checkTrustedInit(X509Certificate[] chain,
156156
"null or zero-length authentication type");
157157
}
158158

159-
Validator v = null;
159+
Validator v;
160160
if (checkClientTrusted) {
161161
v = clientValidator;
162162
if (v == null) {
@@ -197,7 +197,7 @@ private void checkTrusted(X509Certificate[] chain,
197197
boolean checkClientTrusted) throws CertificateException {
198198
Validator v = checkTrustedInit(chain, authType, checkClientTrusted);
199199

200-
X509Certificate[] trustedChain = null;
200+
X509Certificate[] trustedChain;
201201
if ((socket != null) && socket.isConnected() &&
202202
(socket instanceof SSLSocket)) {
203203

@@ -254,7 +254,7 @@ private void checkTrusted(X509Certificate[] chain,
254254
boolean checkClientTrusted) throws CertificateException {
255255
Validator v = checkTrustedInit(chain, authType, checkClientTrusted);
256256

257-
X509Certificate[] trustedChain = null;
257+
X509Certificate[] trustedChain;
258258
if (engine != null) {
259259
SSLSession session = engine.getHandshakeSession();
260260
if (session == null) {

0 commit comments

Comments
 (0)
Please sign in to comment.