You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/07/17 09:37:24 UTC
[1/3] camel git commit: CAMEL-8946: camel-netty may hide exception.
Thanks to Joe Qiang Luo for unit test
Repository: camel
Updated Branches:
refs/heads/master ccf5b2823 -> ba5c56f55
CAMEL-8946: camel-netty may hide exception. Thanks to Joe Qiang Luo for unit test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/10f3ff66
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/10f3ff66
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/10f3ff66
Branch: refs/heads/master
Commit: 10f3ff6616599fa849a95cd75bc6d9b7dd331153
Parents: ccf5b28
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jul 17 09:36:14 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jul 17 09:36:14 2015 +0200
----------------------------------------------------------------------
.../http/NettyHttpSSLHandshakeErrorTest.java | 60 +++++++++++++++++++
.../src/test/resources/jsse/client-keystore.jks | Bin 0 -> 1344 bytes
.../test/resources/jsse/client-truststore.jks | Bin 0 -> 639 bytes
.../src/test/resources/jsse/server-keystore.jks | Bin 0 -> 1345 bytes
.../test/resources/jsse/server-truststore.jks | Bin 0 -> 639 bytes
.../netty/handlers/ClientChannelHandler.java | 9 ++-
6 files changed, 67 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/10f3ff66/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLHandshakeErrorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLHandshakeErrorTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLHandshakeErrorTest.java
new file mode 100644
index 0000000..b6b45b5
--- /dev/null
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLHandshakeErrorTest.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.netty.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultExchange;
+import org.junit.Test;
+
+public class NettyHttpSSLHandshakeErrorTest extends BaseNettyTest {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testHttpsHandshakeError() throws Exception {
+ // ibm jdks dont have sun security algorithms
+ if (isJavaVendor("ibm")) {
+ return;
+ }
+
+ getMockEndpoint("mock:target").expectedMessageCount(0);
+
+ context.addRoutes(new RouteBuilder() {
+ public void configure() {
+ from("netty-http:https://localhost:{{port}}?ssl=true&needClientAuth=true&keyStoreFormat=JKS&passphrase=storepassword&keyStoreResource=jsse/server-keystore.jks&trustStoreResource=jsse/server-truststore.jks")
+ .to("mock:target");
+ }
+ });
+ context.start();
+
+ DefaultExchange exchange = new DefaultExchange(context);
+
+ Exchange response = template.send("netty-http:https://localhost:{{port}}?requestTimeout=10000&throwExceptionOnFailure=false&ssl=true&keyStoreFormat=JKS&passphrase=storepassword&keyStoreResource=jsse/client-keystore.jks&trustStoreResource=jsse/server-truststore.jks", exchange);
+
+ Exception ex = response.getException();
+
+ assertTrue("should have failed", response.isFailed());
+ assertEquals("exception expected", javax.net.ssl.SSLHandshakeException.class, ex.getClass());
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/10f3ff66/components/camel-netty-http/src/test/resources/jsse/client-keystore.jks
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/resources/jsse/client-keystore.jks b/components/camel-netty-http/src/test/resources/jsse/client-keystore.jks
new file mode 100644
index 0000000..bc744f9
Binary files /dev/null and b/components/camel-netty-http/src/test/resources/jsse/client-keystore.jks differ
http://git-wip-us.apache.org/repos/asf/camel/blob/10f3ff66/components/camel-netty-http/src/test/resources/jsse/client-truststore.jks
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/resources/jsse/client-truststore.jks b/components/camel-netty-http/src/test/resources/jsse/client-truststore.jks
new file mode 100644
index 0000000..216bddb
Binary files /dev/null and b/components/camel-netty-http/src/test/resources/jsse/client-truststore.jks differ
http://git-wip-us.apache.org/repos/asf/camel/blob/10f3ff66/components/camel-netty-http/src/test/resources/jsse/server-keystore.jks
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/resources/jsse/server-keystore.jks b/components/camel-netty-http/src/test/resources/jsse/server-keystore.jks
new file mode 100644
index 0000000..22fd44e
Binary files /dev/null and b/components/camel-netty-http/src/test/resources/jsse/server-keystore.jks differ
http://git-wip-us.apache.org/repos/asf/camel/blob/10f3ff66/components/camel-netty-http/src/test/resources/jsse/server-truststore.jks
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/resources/jsse/server-truststore.jks b/components/camel-netty-http/src/test/resources/jsse/server-truststore.jks
new file mode 100644
index 0000000..2447028
Binary files /dev/null and b/components/camel-netty-http/src/test/resources/jsse/server-truststore.jks differ
http://git-wip-us.apache.org/repos/asf/camel/blob/10f3ff66/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
index 7a6d31f..c314e39 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
@@ -83,8 +83,13 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler {
// the state may not be set
if (exchange != null && callback != null) {
- // set the cause on the exchange
- exchange.setException(cause);
+ Throwable initialCause = exchange.getException();
+ if (initialCause != null && initialCause.getCause() == null) {
+ initialCause.initCause(cause);
+ } else {
+ // set the cause on the exchange
+ exchange.setException(cause);
+ }
// close channel in case an exception was thrown
NettyHelper.close(exceptionEvent.getChannel());
[2/3] camel git commit: CAMEL-8946: camel-netty may hide exception.
Thanks to Joe Qiang Luo for unit test
Posted by da...@apache.org.
CAMEL-8946: camel-netty may hide exception. Thanks to Joe Qiang Luo for unit test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6473653e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6473653e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6473653e
Branch: refs/heads/master
Commit: 6473653e65dc73a0bf88804211689898cc2614e2
Parents: 10f3ff6
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jul 17 09:42:16 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jul 17 09:42:16 2015 +0200
----------------------------------------------------------------------
.../http/NettyHttpSSLHandshakeErrorTest.java | 61 +++++++++++++++++++
.../src/test/resources/jsse/client-keystore.jks | Bin 0 -> 1344 bytes
.../test/resources/jsse/client-truststore.jks | Bin 0 -> 639 bytes
.../src/test/resources/jsse/server-keystore.jks | Bin 0 -> 1345 bytes
.../test/resources/jsse/server-truststore.jks | Bin 0 -> 639 bytes
.../netty4/handlers/ClientChannelHandler.java | 9 ++-
6 files changed, 68 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6473653e/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSSLHandshakeErrorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSSLHandshakeErrorTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSSLHandshakeErrorTest.java
new file mode 100644
index 0000000..f917d48
--- /dev/null
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSSLHandshakeErrorTest.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.netty4.http;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultExchange;
+import org.junit.Test;
+
+public class NettyHttpSSLHandshakeErrorTest extends BaseNettyTest {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testHttpsHandshakeError() throws Exception {
+ // ibm jdks dont have sun security algorithms
+ if (isJavaVendor("ibm")) {
+ return;
+ }
+
+ getMockEndpoint("mock:target").expectedMessageCount(0);
+
+ context.addRoutes(new RouteBuilder() {
+ public void configure() {
+ from("netty4-http:https://localhost:{{port}}?ssl=true&needClientAuth=true&keyStoreFormat=JKS&passphrase=storepassword&keyStoreResource=jsse/server-keystore.jks&trustStoreResource=jsse/server-truststore.jks")
+ .to("mock:target");
+ }
+ });
+ context.start();
+
+ DefaultExchange exchange = new DefaultExchange(context);
+
+ Exchange response = template.send("netty4-http:https://localhost:{{port}}?requestTimeout=10000&throwExceptionOnFailure=false&ssl=true&keyStoreFormat=JKS&passphrase=storepassword&keyStoreResource=jsse/client-keystore.jks&trustStoreResource=jsse/server-truststore.jks", exchange);
+
+ Exception ex = response.getException();
+
+ assertTrue("should have failed", response.isFailed());
+ assertNotNull(ex.getCause());
+ assertEquals("exception expected", javax.net.ssl.SSLHandshakeException.class, ex.getCause().getClass());
+
+ assertMockEndpointsSatisfied();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/6473653e/components/camel-netty4-http/src/test/resources/jsse/client-keystore.jks
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/resources/jsse/client-keystore.jks b/components/camel-netty4-http/src/test/resources/jsse/client-keystore.jks
new file mode 100644
index 0000000..bc744f9
Binary files /dev/null and b/components/camel-netty4-http/src/test/resources/jsse/client-keystore.jks differ
http://git-wip-us.apache.org/repos/asf/camel/blob/6473653e/components/camel-netty4-http/src/test/resources/jsse/client-truststore.jks
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/resources/jsse/client-truststore.jks b/components/camel-netty4-http/src/test/resources/jsse/client-truststore.jks
new file mode 100644
index 0000000..216bddb
Binary files /dev/null and b/components/camel-netty4-http/src/test/resources/jsse/client-truststore.jks differ
http://git-wip-us.apache.org/repos/asf/camel/blob/6473653e/components/camel-netty4-http/src/test/resources/jsse/server-keystore.jks
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/resources/jsse/server-keystore.jks b/components/camel-netty4-http/src/test/resources/jsse/server-keystore.jks
new file mode 100644
index 0000000..22fd44e
Binary files /dev/null and b/components/camel-netty4-http/src/test/resources/jsse/server-keystore.jks differ
http://git-wip-us.apache.org/repos/asf/camel/blob/6473653e/components/camel-netty4-http/src/test/resources/jsse/server-truststore.jks
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/resources/jsse/server-truststore.jks b/components/camel-netty4-http/src/test/resources/jsse/server-truststore.jks
new file mode 100644
index 0000000..2447028
Binary files /dev/null and b/components/camel-netty4-http/src/test/resources/jsse/server-truststore.jks differ
http://git-wip-us.apache.org/repos/asf/camel/blob/6473653e/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ClientChannelHandler.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ClientChannelHandler.java
index fb71a88..28d6e22 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ClientChannelHandler.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ClientChannelHandler.java
@@ -77,8 +77,13 @@ public class ClientChannelHandler extends SimpleChannelInboundHandler<Object> {
// the state may not be set
if (exchange != null && callback != null) {
- // set the cause on the exchange
- exchange.setException(cause);
+ Throwable initialCause = exchange.getException();
+ if (initialCause != null && initialCause.getCause() == null) {
+ initialCause.initCause(cause);
+ } else {
+ // set the cause on the exchange
+ exchange.setException(cause);
+ }
// close channel in case an exception was thrown
NettyHelper.close(ctx.channel());
[3/3] camel git commit: Fixed CS
Posted by da...@apache.org.
Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ba5c56f5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ba5c56f5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ba5c56f5
Branch: refs/heads/master
Commit: ba5c56f551fba1b0fb647b08973d6b03dece7225
Parents: 6473653
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jul 17 09:44:07 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jul 17 09:44:07 2015 +0200
----------------------------------------------------------------------
.../component/netty/http/NettyHttpSSLHandshakeErrorTest.java | 6 ++++--
.../component/netty4/http/NettyHttpSSLHandshakeErrorTest.java | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ba5c56f5/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLHandshakeErrorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLHandshakeErrorTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLHandshakeErrorTest.java
index b6b45b5..73958fa 100644
--- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLHandshakeErrorTest.java
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSSLHandshakeErrorTest.java
@@ -39,7 +39,8 @@ public class NettyHttpSSLHandshakeErrorTest extends BaseNettyTest {
context.addRoutes(new RouteBuilder() {
public void configure() {
- from("netty-http:https://localhost:{{port}}?ssl=true&needClientAuth=true&keyStoreFormat=JKS&passphrase=storepassword&keyStoreResource=jsse/server-keystore.jks&trustStoreResource=jsse/server-truststore.jks")
+ from("netty-http:https://localhost:{{port}}?ssl=true&needClientAuth=true&keyStoreFormat=JKS"
+ + "&passphrase=storepassword&keyStoreResource=jsse/server-keystore.jks&trustStoreResource=jsse/server-truststore.jks")
.to("mock:target");
}
});
@@ -47,7 +48,8 @@ public class NettyHttpSSLHandshakeErrorTest extends BaseNettyTest {
DefaultExchange exchange = new DefaultExchange(context);
- Exchange response = template.send("netty-http:https://localhost:{{port}}?requestTimeout=10000&throwExceptionOnFailure=false&ssl=true&keyStoreFormat=JKS&passphrase=storepassword&keyStoreResource=jsse/client-keystore.jks&trustStoreResource=jsse/server-truststore.jks", exchange);
+ Exchange response = template.send("netty-http:https://localhost:{{port}}?requestTimeout=10000&throwExceptionOnFailure=false"
+ + "&ssl=true&keyStoreFormat=JKS&passphrase=storepassword&keyStoreResource=jsse/client-keystore.jks&trustStoreResource=jsse/server-truststore.jks", exchange);
Exception ex = response.getException();
http://git-wip-us.apache.org/repos/asf/camel/blob/ba5c56f5/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSSLHandshakeErrorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSSLHandshakeErrorTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSSLHandshakeErrorTest.java
index f917d48..d0b3bf7 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSSLHandshakeErrorTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpSSLHandshakeErrorTest.java
@@ -39,7 +39,8 @@ public class NettyHttpSSLHandshakeErrorTest extends BaseNettyTest {
context.addRoutes(new RouteBuilder() {
public void configure() {
- from("netty4-http:https://localhost:{{port}}?ssl=true&needClientAuth=true&keyStoreFormat=JKS&passphrase=storepassword&keyStoreResource=jsse/server-keystore.jks&trustStoreResource=jsse/server-truststore.jks")
+ from("netty4-http:https://localhost:{{port}}?ssl=true&needClientAuth=true&keyStoreFormat=JKS"
+ + "&passphrase=storepassword&keyStoreResource=jsse/server-keystore.jks&trustStoreResource=jsse/server-truststore.jks")
.to("mock:target");
}
});
@@ -47,7 +48,8 @@ public class NettyHttpSSLHandshakeErrorTest extends BaseNettyTest {
DefaultExchange exchange = new DefaultExchange(context);
- Exchange response = template.send("netty4-http:https://localhost:{{port}}?requestTimeout=10000&throwExceptionOnFailure=false&ssl=true&keyStoreFormat=JKS&passphrase=storepassword&keyStoreResource=jsse/client-keystore.jks&trustStoreResource=jsse/server-truststore.jks", exchange);
+ Exchange response = template.send("netty4-http:https://localhost:{{port}}?requestTimeout=10000&throwExceptionOnFailure=false"
+ + "&ssl=true&keyStoreFormat=JKS&passphrase=storepassword&keyStoreResource=jsse/client-keystore.jks&trustStoreResource=jsse/server-truststore.jks", exchange);
Exception ex = response.getException();