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 2019/11/08 21:44:24 UTC
[camel] 01/02: [CAMEL-14156] Avoid NPE with endpoint is null in
JmsBinding (#3328)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 5528d3c1568a7d3da30866c4d0f23b0c72c22303
Author: Jean-Baptiste Onofré <jb...@apache.org>
AuthorDate: Fri Nov 8 22:14:12 2019 +0100
[CAMEL-14156] Avoid NPE with endpoint is null in JmsBinding (#3328)
---
.../org/apache/camel/component/jms/JmsBindingTest.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java
index 00f70d7..1c29e26 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java
@@ -22,6 +22,9 @@ import java.time.Instant;
import java.util.Date;
import org.apache.activemq.command.ActiveMQBlobMessage;
+import org.apache.activemq.command.ActiveMQTextMessage;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.DefaultExchange;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -54,6 +57,18 @@ public class JmsBindingTest {
}
@Test
+ public void noEndpointTest() throws Exception {
+ JmsBinding testBindingWithoutEndpoint = new JmsBinding();
+ ActiveMQTextMessage message = new ActiveMQTextMessage();
+ message.setText("test");
+ DefaultCamelContext camelContext = new DefaultCamelContext();
+ DefaultExchange exchange = new DefaultExchange(camelContext);
+ exchange.getIn().setBody("test");
+ exchange.getIn().setHeader("JMSCorrelationID", null);
+ testBindingWithoutEndpoint.appendJmsProperties(message, exchange);
+ }
+
+ @Test
public void testExtractNullBodyFromJmsShouldReturnNull() throws Exception {
assertNull(jmsBindingUnderTest.extractBodyFromJms(null, new ActiveMQBlobMessage()));
}