You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gt...@apache.org on 2009/09/02 19:46:15 UTC

svn commit: r810628 - in /camel/trunk/components/camel-jms/src: main/java/org/apache/camel/component/jms/JmsBinding.java test/java/org/apache/camel/component/jms/JmsBindingTest.java

Author: gtully
Date: Wed Sep  2 17:46:15 2009
New Revision: 810628

URL: http://svn.apache.org/viewvc?rev=810628&view=rev
Log:
resolve https://issues.apache.org/activemq/browse/CAMEL-1982

Added:
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java   (with props)
Modified:
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java?rev=810628&r1=810627&r2=810628&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java (original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java Wed Sep  2 17:46:15 2009
@@ -100,7 +100,7 @@
         try {
             // is a custom message converter configured on endpoint then use it instead of doing the extraction
             // based on message type
-            if (endpoint.getMessageConverter() != null) {
+            if (endpoint != null && endpoint.getMessageConverter() != null) {
                 if (LOG.isTraceEnabled()) {
                     LOG.trace("Extracting body using a custom MessageConverter: " + endpoint.getMessageConverter() + " from JMS message: " + message);
                 }
@@ -108,7 +108,7 @@
             }
 
             // if we are configured to not map the jms message then return it as body
-            if (!endpoint.getConfiguration().isMapJmsMessage()) {
+            if (endpoint != null && !endpoint.getConfiguration().isMapJmsMessage()) {
                 if (LOG.isTraceEnabled()) {
                     LOG.trace("Option map JMS message is false so using JMS message as body: " + message);
                 }
@@ -396,7 +396,7 @@
         }
 
         // use a custom message converter
-        if (endpoint.getMessageConverter() != null) {
+        if (endpoint != null && endpoint.getMessageConverter() != null) {
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Creating JmsMessage using a custom MessageConverter: " + endpoint.getMessageConverter() + " with body: " + body);
             }

Added: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java?rev=810628&view=auto
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java (added)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java Wed Sep  2 17:46:15 2009
@@ -0,0 +1,34 @@
+/**
+ * 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.jms;
+
+import static org.junit.Assert.assertNull;
+
+import org.apache.activemq.command.ActiveMQBlobMessage;
+import org.junit.Test;
+
+/**
+ * @version $Revision$
+ */
+public class JmsBindingTest {
+
+    @Test
+    public void testJmsBindingNoArgs() throws Exception {
+        JmsBinding underTest = new JmsBinding();
+        assertNull(underTest.extractBodyFromJms(null, new ActiveMQBlobMessage()));
+    }
+}

Propchange: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsBindingTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date