svn commit: r690927 - in /activemq/camel/trunk/components: camel-jms/src/main/java/org/apache/camel/component/jms/ camel-mina/src/main/java/org/apache/camel/component/mina/

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r690927 - in /activemq/camel/trunk/components: camel-jms/src/main/java/org/apache/camel/component/jms/ camel-mina/src/main/java/org/apache/camel/component/mina/

ningjiang
Author: ningjiang
Date: Mon Sep  1 02:49:33 2008
New Revision: 690927

URL: http://svn.apache.org/viewvc?rev=690927&view=rev
Log:
CAMEL-873 CAMEL-400 cleaned up code and fixed the camel-jms build error

Modified:
    activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsIOConverter.java
    activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
    activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHolder.java

Modified: activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsIOConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsIOConverter.java?rev=690927&r1=690926&r2=690927&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsIOConverter.java (original)
+++ activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsIOConverter.java Mon Sep  1 02:49:33 2008
@@ -31,32 +31,33 @@
 import javax.jms.TextMessage;
 
 import org.apache.camel.Converter;
+import org.apache.camel.Exchange;
 import org.apache.camel.converter.NIOConverter;
 
 /**
  * Some simple payload conversions to I/O <a
  * href="http://activemq.apache.org/camel/type-converter.html">Type Converters</a>
- *
+ *
  * @version $Revision$
  */
 
 @Converter
 public final class JmsIOConverter {
-    
-    private JmsIOConverter() {        
+
+    private JmsIOConverter() {
     }
-    
+
     /**
      * @param message
      * @return a ByteBuffer
      * @throws Exception
      */
     @Converter
-    public static ByteBuffer toByteBuffer(final Message message) throws Exception {
+    public static ByteBuffer toByteBuffer(final Message message, Exchange exchange) throws Exception {
 
         if (message instanceof TextMessage) {
             final String text = ((TextMessage)message).getText();
-            return NIOConverter.toByteBuffer(text);
+            return NIOConverter.toByteBuffer(text, exchange);
         }
         if (message instanceof BytesMessage) {
             final BytesMessage bmsg = (BytesMessage)message;

Modified: activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java?rev=690927&r1=690926&r2=690927&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java (original)
+++ activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java Mon Sep  1 02:49:33 2008
@@ -109,24 +109,7 @@
                 } else {
                     body = MinaPayloadHelper.getIn(endpoint, exchange);
                 }
-                boolean failed = exchange.isFailed();
-
-                /*if (failed) {
-                    // can not write a response since the exchange is failed and we don't know in what state the
-                    // in/out messages are in so the session is closed
-                    LOG.warn("Can not write body since the exchange is failed, closing session: " + exchange);
-                    session.close();
-                    if (exchange.getException() != null) {
-                        throw new CamelException(exchange.getException());
-                    }
-                    if (exchange.getFault(false) != null) {
-                        if (exchange.getFault().getBody() instanceof Throwable) {
-                            System.out.println("throw the exception here");
-                            throw new CamelException((Throwable)exchange.getFault().getBody());
-                        }
-                    }
-
-                } else*/
+                // send message back
                 if (body == null) {
                     // must close session if no data to write otherwise client will never receive a response
                     // and wait forever (if not timing out)

Modified: activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHolder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHolder.java?rev=690927&r1=690926&r2=690927&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHolder.java (original)
+++ activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHolder.java Mon Sep  1 02:49:33 2008
@@ -74,7 +74,7 @@
             payload.faultBody = exchange.getFault().getBody();
             payload.faultHeaders.putAll(exchange.getFault().getHeaders());
         }
-        System.out.println("marshal " + payload);
+
         return payload;
     }