Skip to content

Commit 419c03f

Browse files
authored
Minor cleanup (#688)
Clean up some unused variable and method ErrorProne warnings. Eliminate debug logging from NativeLibraryLoader in tests.
1 parent 2c7c552 commit 419c03f

File tree

5 files changed

+7
-15
lines changed

5 files changed

+7
-15
lines changed

openjdk-integ-tests/src/test/java/org/conscrypt/java/security/SignatureTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void test_getInstance() throws Exception {
101101
.run(new ServiceTester.Test() {
102102
@Override
103103
public void test(Provider provider, String algorithm) throws Exception {
104-
KeyPair kp = keyPair(algorithm, provider.getName());
104+
KeyPair kp = keyPair(algorithm);
105105
// Signature.getInstance(String)
106106
Signature sig1 = Signature.getInstance(algorithm);
107107
assertEquals(algorithm, sig1.getAlgorithm());
@@ -125,7 +125,7 @@ public void test(Provider provider, String algorithm) throws Exception {
125125
private final Map<String, KeyPair> keypairAlgorithmToInstance
126126
= new HashMap<String, KeyPair>();
127127

128-
private KeyPair keyPair(String sigAlgorithm, String providerName) throws Exception {
128+
private KeyPair keyPair(String sigAlgorithm) throws Exception {
129129
String sigAlgorithmUpperCase = sigAlgorithm.toUpperCase(Locale.US);
130130
if (sigAlgorithmUpperCase.endsWith("ENCRYPTION")) {
131131
sigAlgorithm = sigAlgorithm.substring(0, sigAlgorithm.length()-"ENCRYPTION".length());
@@ -161,15 +161,15 @@ private KeyPair keyPair(String sigAlgorithm, String providerName) throws Excepti
161161
return kp;
162162
}
163163

164-
private AlgorithmParameterSpec getAlgParamSpec(String algorithm, Provider p) {
164+
private AlgorithmParameterSpec getAlgParamSpec(String algorithm) {
165165
if (algorithm.equalsIgnoreCase("RSASSA-PSS")) {
166166
return PSSParameterSpec.DEFAULT;
167167
}
168168
return null;
169169
}
170170

171171
private void test_Signature(Signature sig, KeyPair keyPair) throws Exception {
172-
AlgorithmParameterSpec params = getAlgParamSpec(sig.getAlgorithm(), sig.getProvider());
172+
AlgorithmParameterSpec params = getAlgParamSpec(sig.getAlgorithm());
173173
sig.initSign(keyPair.getPrivate());
174174
if (params != null) {
175175
sig.setParameter(params);
@@ -2729,7 +2729,7 @@ public void testVerify_NONEwithRSA_Key_SignatureTooLarge_Failure() throws Except
27292729

27302730
@Test
27312731
public void testSign_NONEwithECDSA_Key_Success() throws Exception {
2732-
KeyPair keys = keyPair("NONEwithECDSA", null);
2732+
KeyPair keys = keyPair("NONEwithECDSA");
27332733
Signature sig = Signature.getInstance("NONEwithECDSA");
27342734

27352735
sig.initSign(keys.getPrivate());

openjdk-integ-tests/src/test/java/org/conscrypt/javax/crypto/CipherTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -4321,6 +4321,7 @@ public void test_DefaultGCMTagSizeAlgorithmParameterSpec() throws Exception {
43214321
(byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 });
43224322
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, AES), param);
43234323
byte[] ciphertext = cipher.update(input);
4324+
assertEquals(16, ciphertext.length);
43244325
byte[] tag = cipher.doFinal();
43254326
assertEquals(12, tag.length);
43264327
}

openjdk-integ-tests/src/test/java/org/conscrypt/javax/net/ssl/SSLEngineVersionCompatibilityTest.java

-8
Original file line numberDiff line numberDiff line change
@@ -729,18 +729,10 @@ private void assertConnected(TestSSLEnginePair e) {
729729
assertConnected(e.client, e.server);
730730
}
731731

732-
private void assertNotConnected(TestSSLEnginePair e) {
733-
assertNotConnected(e.client, e.server);
734-
}
735-
736732
private void assertConnected(SSLEngine a, SSLEngine b) {
737733
assertTrue(connected(a, b));
738734
}
739735

740-
private void assertNotConnected(SSLEngine a, SSLEngine b) {
741-
assertFalse(connected(a, b));
742-
}
743-
744736
private boolean connected(SSLEngine a, SSLEngine b) {
745737
return (a.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING
746738
&& b.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING

openjdk-integ-tests/src/test/java/org/conscrypt/javax/net/ssl/SSLSocketTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ public void test_SSLSocket_setEnabledProtocols() throws Exception {
388388
@Test
389389
public void test_SSLSocket_noncontiguousProtocols_useLower() throws Exception {
390390
TestSSLContext c = TestSSLContext.create();
391-
SSLContext serverContext = c.serverContext;
392391
SSLContext clientContext = c.clientContext;
393392
SSLSocket client = (SSLSocket)
394393
clientContext.getSocketFactory().createSocket(c.host, c.port);
@@ -420,7 +419,6 @@ public void test_SSLSocket_noncontiguousProtocols_useLower() throws Exception {
420419
@Test
421420
public void test_SSLSocket_noncontiguousProtocols_canNegotiate() throws Exception {
422421
TestSSLContext c = TestSSLContext.create();
423-
SSLContext serverContext = c.serverContext;
424422
SSLContext clientContext = c.clientContext;
425423
SSLSocket client = (SSLSocket)
426424
clientContext.getSocketFactory().createSocket(c.host, c.port);

test_logging.properties

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ org.conscrypt.level=ALL
88
org.conscrypt.handler=java.util.logging.ConsoleHandler
99

1010
# Avoid nuisance logs in tests.
11+
org.conscrypt.NativeLibraryLoader.level=INFO
1112
org.conscrypt.NativeSslSession.level=SEVERE
1213
org.conscrypt.TrustManagerImpl.level=INFO

0 commit comments

Comments
 (0)