Skip to content

Commit c23a0a4

Browse files
committed
Bradford's comments
1 parent 9248602 commit c23a0a4

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

test/jdk/sun/security/ssl/X509KeyManager/NullCases.java

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,32 @@ public void JDK6302304Test() throws Exception {
100100

101101
final X509KeyManager km = generateNullKm();
102102

103-
km.getServerAliases(null, null);
104-
km.getClientAliases(null, null);
105-
km.getCertificateChain(null);
106-
km.getPrivateKey(null);
107-
km.chooseServerAlias(null, null, null);
108-
km.chooseClientAlias(null, null, null);
103+
final String[] serverAliases =
104+
km.getServerAliases(null, null);
105+
Asserts.assertNull(serverAliases,
106+
"Should return null if server alias not found");
107+
final String[] clientAliases =
108+
km.getClientAliases(null, null);
109+
Asserts.assertNull(clientAliases,
110+
"Should return null if client alias not found");
111+
112+
final X509Certificate[] certs =
113+
km.getCertificateChain(null);
114+
final PrivateKey priv =
115+
km.getPrivateKey(null);
116+
Asserts.assertNull(certs,
117+
"Should return null if the alias can't be found");
118+
Asserts.assertNull(priv,
119+
"Should return null if the alias can't be found");
120+
121+
final String serverAlias =
122+
km.chooseServerAlias(null, null, null);
123+
Asserts.assertNull(serverAlias,
124+
"Should return null if the alias can't be chosen");
125+
final String clientAlias =
126+
km.chooseClientAlias(null, null, null);
127+
Asserts.assertNull(clientAlias,
128+
"Should return null if the alias can't be chosen");
109129
}
110130

111131
@Test
@@ -164,7 +184,6 @@ public void nonexistentBuilderTest() {
164184

165185
@Test
166186
public void nonexistentKSTest() {
167-
168187
final X509Certificate[] certs = km.getCertificateChain("RSA.0.1");
169188
final PrivateKey priv = km.getPrivateKey("RSA.0.1");
170189

test/jdk/sun/security/ssl/X509KeyManager/X509KeyManagerNegativeTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static void beforeAll() throws Exception {
6767
exceptionThrowingKS.load(null, null);
6868

6969
exceptionThrowingKMF
70-
.init((KeyStore) exceptionThrowingKS, null);
70+
.init(exceptionThrowingKS, null);
7171
exceptionThrowingKM =
7272
(X509KeyManager) exceptionThrowingKMF.getKeyManagers()[0];
7373
}
@@ -80,7 +80,6 @@ public static void cleanup() {
8080

8181
@Test
8282
public void ksExceptionTest() {
83-
// recording logs to the output stream
8483
Asserts.assertThrows(ConcurrentModificationException.class,
8584
() -> exceptionThrowingKM.getCertificateChain("RSA.0.0"));
8685
Asserts.assertThrows(ConcurrentModificationException.class,
@@ -100,7 +99,8 @@ public static class MyExceptionKS extends KeyStoreSpi {
10099

101100
@Override
102101
public KeyStore.Entry engineGetEntry(String alias,
103-
KeyStore.ProtectionParameter param) {
102+
KeyStore.ProtectionParameter param)
103+
{
104104
throw new ConcurrentModificationException("getEntry exception");
105105
}
106106

0 commit comments

Comments
 (0)