This is an automated email from the ASF dual-hosted git repository.
dkulp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/main by this push:
new 8a706ea483 Fix tests with Java11
8a706ea483 is described below
commit 8a706ea4836220b6053ce0fa3a96badd228607b4
Author: Daniel Kulp <[email protected]>
AuthorDate: Tue Apr 25 18:09:59 2023 -0400
Fix tests with Java11
---
.../cxf/transport/http/HttpClientHTTPConduit.java | 21 +++++++++++++++------
.../cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java | 3 +--
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git
a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java
index e228893a9b..01fd631afc 100644
---
a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java
+++
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java
@@ -71,6 +71,7 @@ import org.apache.cxf.Bus;
import org.apache.cxf.common.util.PropertyUtils;
import org.apache.cxf.configuration.jsse.TLSClientParameters;
import org.apache.cxf.helpers.HttpHeaderHelper;
+import org.apache.cxf.helpers.JavaUtils;
import org.apache.cxf.io.CacheAndWriteOutputStream;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageUtils;
@@ -115,6 +116,9 @@ public class HttpClientHTTPConduit extends
URLConnectionHTTPConduit {
clientParameters = new TLSClientParameters();
}
Object o =
message.getContextualProperty("force.urlconnection.http.conduit");
+ if (o == null) {
+ o = message.get("USING_URLCONNECTION");
+ }
//o = true;
if ("https".equals(uri.getScheme()) && clientParameters != null) {
if (clientParameters.getSSLSocketFactory() != null) {
@@ -123,13 +127,18 @@ public class HttpClientHTTPConduit extends
URLConnectionHTTPConduit {
//the SSLSocketFactory.
o = Boolean.TRUE;
}
- if (clientParameters.getSslContext() != null
- && clientParameters.isDisableCNCheck()) {
- // If they specify their own SSLContext, we cannot handle the
- // HostnameVerifier so we'll need to use the URLConnection
- o = Boolean.TRUE;
+ if (clientParameters.isDisableCNCheck()) {
+ if (clientParameters.getSslContext() != null) {
+ // If they specify their own SSLContext, we cannot handle
the
+ // HostnameVerifier so we'll need to use the URLConnection
+ o = Boolean.TRUE;
+ }
+ if (clientParameters.getTrustManagers() != null
+ && JavaUtils.getJavaMajorVersion() < 14) {
+ // trustmanagers hacks don't work on Java11
+ o = Boolean.TRUE;
+ }
}
-
}
if (Boolean.TRUE.equals(o)) {
message.put("USING_URLCONNECTION", Boolean.TRUE);
diff --git
a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
index feb549ea2b..af42ca7526 100644
---
a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
+++
b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_wsdl/WSAPureWsdlTest.java
@@ -117,8 +117,7 @@ public class WSAPureWsdlTest extends AbstractWSATestBase {
fail("should have failed");
} catch (Exception t) {
//expected
- assertTrue(t.getCause().getCause().toString(),
- t.getCause() instanceof java.net.ConnectException
+ assertTrue(t.getCause() instanceof java.net.ConnectException
|| t.getCause().getCause() instanceof
java.net.ConnectException
|| t.getCause().getCause() instanceof
java.net.SocketTimeoutException);
}