< prev index next >
test/jdk/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 2016, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 129,144 ****
try {
sslIS.read();
sslOS.write('A');
sslOS.flush();
! } catch (SSLHandshakeException e) {
! if (expectFail && !e.toString().contains("certificate_unknown")) {
! throw new RuntimeException(
! "Expected to see certificate_unknown in exception output",
! e);
! }
}
}
@Override
protected SSLContext createClientSSLContext() throws Exception {
--- 129,142 ----
try {
sslIS.read();
sslOS.write('A');
sslOS.flush();
! } catch (SSLException ssle) {
! if (!expectFail) {
! throw ssle;
! } // Otherwise, ignore.
}
}
@Override
protected SSLContext createClientSSLContext() throws Exception {
*** 156,172 ****
try {
sslOS.write('B');
sslOS.flush();
sslIS.read();
} catch (SSLHandshakeException e) {
// focus on the CertPathValidatorException
Throwable t = e.getCause().getCause();
! if ((t == null)
! || (expectFail && !t.toString().contains("MD5withRSA"))) {
throw new RuntimeException(
"Expected to see MD5withRSA in exception output", t);
}
}
}
/*
* =============================================================
--- 154,173 ----
try {
sslOS.write('B');
sslOS.flush();
sslIS.read();
} catch (SSLHandshakeException e) {
+ if (expectFail) {
// focus on the CertPathValidatorException
Throwable t = e.getCause().getCause();
! if (t == null || !t.toString().contains("MD5withRSA")) {
throw new RuntimeException(
"Expected to see MD5withRSA in exception output", t);
}
+ } else {
+ throw e;
+ }
}
}
/*
* =============================================================
< prev index next >