camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r690920 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/converter/ components/camel-mina/src/main/java/org/apache/camel/component/mina/ components/camel-mina/src/test/java/org...
Date Mon, 01 Sep 2008 09:29:50 GMT
Author: ningjiang
Date: Mon Sep  1 02:29:48 2008
New Revision: 690920

URL: http://svn.apache.org/viewvc?rev=690920&view=rev
Log:
CAMEL-873 CAMEL-400

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java
    activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.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/MinaConverter.java
    activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
    activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHelper.java
    activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHolder.java
    activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
    activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConverterTest.java
    activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
    activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaUdpWithInOutUsingPlainSocketTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java Mon Sep 
1 02:29:48 2008
@@ -29,7 +29,9 @@
  * @version $Revision$
  */
 public interface Exchange {
-    
+
+    String CHARSET_NAME = "org.apache.camel.Exchange.CharsetName";
+
     /**
      * Returns the {@link ExchangePattern} (MEP) of this exchange.
      *
@@ -173,7 +175,7 @@
      * Returns true if this exchange is transacted
      */
     boolean isTransacted();
-    
+
     /**
      * Returns the container so that a processor can resolve endpoints from URIs
      *
@@ -194,7 +196,7 @@
 
     /**
      * Copies the data into this exchange from the given exchange
-     * 
+     *
      * @param source is the source from which headers and messages will be copied
      */
     void copyFrom(Exchange source);

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java
Mon Sep  1 02:29:48 2008
@@ -39,8 +39,10 @@
 import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 import java.net.URL;
+import java.nio.charset.Charset;
 import java.util.Properties;
 
 import javax.xml.transform.OutputKeys;
@@ -52,6 +54,7 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.apache.camel.Converter;
+import org.apache.camel.Exchange;
 import org.apache.camel.util.CollectionStringBuffer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -135,10 +138,21 @@
     }
 
     @Converter
-    public static String toString(byte[] data) {
+    public static String toString(byte[] data, Exchange exchange) {
+        if (exchange != null) {
+            String charsetName = (String) exchange.getProperty(Exchange.CHARSET_NAME);
+            if (charsetName != null) {
+                try {
+                    return new String(data, charsetName);
+                } catch (UnsupportedEncodingException e) {
+                    LOG.warn("Can't convert the byte to String with the charset " + charsetName,
e);
+                }
+            }
+        }
         return new String(data);
     }
 
+
     @Converter
     public static String toString(File file) throws IOException {
         return toString(toReader(file));
@@ -226,7 +240,7 @@
             return new ObjectInputStream(stream);
         }
     }
-    
+
     @Converter
     public static byte[] toBytes(InputStream stream) throws IOException {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java
Mon Sep  1 02:29:48 2008
@@ -21,9 +21,12 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
 import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
 
 import org.apache.camel.Converter;
+import org.apache.camel.Exchange;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -49,8 +52,8 @@
     }
 
     @Converter
-    public static String toString(ByteBuffer buffer) {
-        return IOConverter.toString(buffer.array());
+    public static String toString(ByteBuffer buffer, Exchange exchange) {
+        return IOConverter.toString(buffer.array(), exchange);
     }
 
     @Converter
@@ -84,9 +87,22 @@
     }
 
     @Converter
-    public static ByteBuffer toByteBuffer(String value) {
+    public static ByteBuffer toByteBuffer(String value, Exchange exchange) {
         ByteBuffer buf = ByteBuffer.allocate(value.length());
-        byte[] bytes = value.getBytes();
+        byte[] bytes = null;
+        if (exchange != null) {
+            String charsetName = (String)exchange.getProperty(Exchange.CHARSET_NAME);
+            if (charsetName != null) {
+                try {
+                    bytes = value.getBytes(charsetName);
+                } catch (UnsupportedEncodingException e) {
+                    LOG.warn("Can't convert the byte to String with the charset " + charsetName,
e);
+                }
+            }
+        }
+        if (bytes == null) {
+            bytes = value.getBytes();
+        }
         buf.put(bytes);
         return buf;
     }

Modified: activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
(original)
+++ activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
Mon Sep  1 02:29:48 2008
@@ -144,7 +144,9 @@
         }
 
         MinaEndpoint endpoint = new MinaEndpoint(uri, this, address, acceptor, acceptorConfig,
connector, connectorConfig, lazySessionCreation, timeout, transferExchange, sync);
-
+        if (encoding != null) {
+            endpoint.setCharsetName(getEncodingParameter("MinaProducer", encoding).name());
+        }
         // set sync or async mode after endpoint is created
         if (sync) {
             endpoint.setExchangePattern(ExchangePattern.InOut);
@@ -204,7 +206,9 @@
         }
 
         MinaEndpoint endpoint = new MinaEndpoint(uri, this, address, acceptor, acceptorConfig,
connector, connectorConfig, lazySessionCreation, timeout, transferExchange, sync);
-
+        if (encoding != null) {
+            endpoint.setCharsetName(getEncodingParameter("MinaProducer", encoding).name());
+        }
         // set sync or async mode after endpoint is created
         if (sync) {
             endpoint.setExchangePattern(ExchangePattern.InOut);

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=690920&r1=690919&r2=690920&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:29:48 2008
@@ -19,6 +19,7 @@
 import java.net.SocketAddress;
 
 import org.apache.camel.CamelException;
+import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.impl.DefaultConsumer;
 import org.apache.camel.util.ExchangeHelper;
@@ -94,6 +95,10 @@
             }
 
             MinaExchange exchange = endpoint.createExchange(session, object);
+            //Set the exchange charset property for converting
+            if (endpoint.getCharsetName() != null) {
+                exchange.setProperty(Exchange.CHARSET_NAME, endpoint.getCharsetName());
+            }
             getProcessor().process(exchange);
 
             // if sync then we should return a response
@@ -106,12 +111,23 @@
                 }
                 boolean failed = exchange.isFailed();
 
-                if (failed) {
+                /*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();
-                } else if (body == null) {
+                    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*/
+                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)
                     LOG.warn("Can not write body since its null, closing session: " + exchange);
@@ -123,7 +139,7 @@
                     }
                     MinaHelper.writeBody(session, body, exchange);
                 }
-            } 
+            }
         }
 
     }

Modified: activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConverter.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConverter.java
(original)
+++ activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConverter.java
Mon Sep  1 02:29:48 2008
@@ -21,6 +21,7 @@
 import java.io.ObjectInput;
 
 import org.apache.camel.Converter;
+import org.apache.camel.Exchange;
 import org.apache.camel.converter.IOConverter;
 import org.apache.mina.common.ByteBuffer;
 
@@ -48,9 +49,8 @@
     }
 
     @Converter
-    public static String toString(ByteBuffer buffer) {
-        // TODO: CAMEL-381, we should have type converters to strings that accepts a Charset
parameter to handle encoding
-        return IOConverter.toString(toByteArray(buffer));
+    public static String toString(ByteBuffer buffer, Exchange exchange) {
+        return IOConverter.toString(toByteArray(buffer), exchange);
     }
 
     @Converter

Modified: activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
(original)
+++ activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
Mon Sep  1 02:29:48 2008
@@ -17,6 +17,7 @@
 package org.apache.camel.component.mina;
 
 import java.net.SocketAddress;
+import java.nio.charset.Charset;
 
 import org.apache.camel.Consumer;
 import org.apache.camel.ExchangePattern;
@@ -47,6 +48,7 @@
     private final boolean lazySessionCreation;
     private final boolean transferExchange;
     private final boolean sync;
+    private String charsetName;
 
     public MinaEndpoint(String endpointUri, MinaComponent component, SocketAddress address,
                         IoAcceptor acceptor, IoAcceptorConfig acceptorConfig, IoConnector
connector,
@@ -67,6 +69,7 @@
         this.sync = sync;
     }
 
+
     @SuppressWarnings({"unchecked"})
     public Producer<MinaExchange> createProducer() throws Exception {
         return new MinaProducer(this);
@@ -128,4 +131,12 @@
     public boolean isSync() {
         return sync;
     }
+
+    public void setCharsetName(String charset) {
+        this.charsetName = charset;
+    }
+
+    public String getCharsetName() {
+        return charsetName;
+    }
 }

Modified: activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHelper.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHelper.java
(original)
+++ activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaPayloadHelper.java
Mon Sep  1 02:29:48 2008
@@ -35,7 +35,7 @@
 
     public static Object getIn(MinaEndpoint endpoint, Exchange exchange) {
         if (endpoint.isTransferExchange()) {
-            // we should transfer the entire exchange over the wire (includes in/out)
+            // we should transfer the entire exchange over the wire (includes in/out)\
             return MinaPayloadHolder.marshal(exchange);
         } else {
             // normal transfer using the body only

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=690920&r1=690919&r2=690920&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:29:48 2008
@@ -33,6 +33,8 @@
  *     <li>out body</li>
  *     <li>in headers</li>
  *     <li>out headers</li>
+ *     <li>fault body </li>
+ *     <li>fault headers</li>
  *     <li>exchange properties</li>
  *     <li>exception</li>
  * </ul>
@@ -44,9 +46,11 @@
 
     private Object inBody;
     private Object outBody;
+    private Object faultBody;
     private Map<String, Object> inHeaders = new LinkedHashMap<String, Object>();
     private Map<String, Object> outHeaders = new LinkedHashMap<String, Object>();
     private Map<String, Object> properties = new LinkedHashMap<String, Object>();
+    private Map<String, Object> faultHeaders = new LinkedHashMap<String, Object>();
     private Throwable exception;
 
     /**
@@ -66,7 +70,11 @@
         payload.outHeaders.putAll(exchange.getOut().getHeaders());
         payload.properties.putAll(exchange.getProperties());
         payload.exception = exchange.getException();
-
+        if (exchange.getFault(false) != null) {
+            payload.faultBody = exchange.getFault().getBody();
+            payload.faultHeaders.putAll(exchange.getFault().getHeaders());
+        }
+        System.out.println("marshal " + payload);
         return payload;
     }
 
@@ -81,6 +89,10 @@
         exchange.getOut().setBody(payload.outBody);
         exchange.getIn().setHeaders(payload.inHeaders);
         exchange.getOut().setHeaders(payload.outHeaders);
+        if (payload.faultBody != null) {
+            exchange.getFault().setBody(payload.faultBody);
+            exchange.getFault().setHeaders(payload.faultHeaders);
+        }
         for (String key : payload.properties.keySet()) {
             exchange.setProperty(key, payload.properties.get(key));
         }
@@ -89,8 +101,8 @@
 
     public String toString() {
         return "MinaPayloadHolder{" + "inBody=" + inBody + ", outBody=" + outBody + ", inHeaders="
-               + inHeaders + ", outHeaders=" + outHeaders + ", properties=" + properties
+ ", exception="
-               + exception + '}';
+               + inHeaders + ", outHeaders=" + outHeaders + ", faultBody=" + faultBody +
" , faultHeaders="
+               + faultHeaders + ", properties=" + properties + ", exception=" + exception
+ '}';
     }
 
 }

Modified: activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
(original)
+++ activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
Mon Sep  1 02:29:48 2008
@@ -134,7 +134,7 @@
         if (session != null) {
             session.close();
         }
-        
+
         super.doStop();
     }
 

Modified: activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConverterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConverterTest.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConverterTest.java
(original)
+++ activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConverterTest.java
Mon Sep  1 02:29:48 2008
@@ -42,7 +42,7 @@
         String in = "Hello World";
         ByteBuffer bb = ByteBuffer.wrap(in.getBytes());
 
-        String out = MinaConverter.toString(bb);
+        String out = MinaConverter.toString(bb, null);
         assertEquals("Hello World", out);
     }
 

Modified: activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
(original)
+++ activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTransferExchangeOptionTest.java
Mon Sep  1 02:29:48 2008
@@ -34,9 +34,19 @@
  */
 public class MinaTransferExchangeOptionTest extends ContextTestSupport {
 
-    private static final String URI = "mina:tcp://localhost:6321?sync=true&transferExchange=true";
+    private static final String URI = "mina:tcp://localhost:6321?sync=true&encoding=UTF-8&transferExchange=true";
 
-    public void testMinaTransferExchangeOption() throws Exception {
+    public void testMianTransferExchangeOptionWithoutException() throws Exception {
+        Exchange exchange = sendExchange(false);
+        assertExchange(exchange, false);
+    }
+
+    public void testMinaTransferExchangeOptionWithException() throws Exception {
+        Exchange exchange = sendExchange(true);
+        assertExchange(exchange, true);
+    }
+
+    private Exchange sendExchange(boolean setException) throws Exception {
         Endpoint endpoint = context.getEndpoint(URI);
         Exchange exchange = endpoint.createExchange();
 
@@ -44,16 +54,28 @@
         message.setBody("Hello!");
         message.setHeader("cheese", "feta");
         exchange.setProperty("ham", "old");
+        exchange.setProperty("setException", setException);
 
         Producer producer = endpoint.createProducer();
         producer.start();
         producer.process(exchange);
 
-        Message out = exchange.getOut();
-        assertNotNull(out);
-        assertEquals("Goodbye!", out.getBody());
-        assertEquals("cheddar", out.getHeader("cheese"));
-        assertEquals("fresh", exchange.getProperty("salami"));
+        return exchange;
+    }
+
+    private void assertExchange(Exchange exchange, boolean hasFault) {
+        if (!hasFault) {
+            Message out = exchange.getOut();
+            assertNotNull(out);
+            assertEquals("Goodbye!", out.getBody());
+            assertEquals("cheddar", out.getHeader("cheese"));
+        } else {
+            Message fault = exchange.getFault();
+            assertNotNull(fault);
+            assertTrue("Should get the InterrupteException exception", fault.getBody() instanceof
InterruptedException);
+            assertEquals("nihao", fault.getHeader("hello"));
+        }
+
 
         // in should stay the same
         Message in = exchange.getIn();
@@ -76,9 +98,15 @@
                         Assert.assertEquals("feta", e.getIn().getHeader("cheese"));
                         Assert.assertEquals("old", e.getProperty("ham"));
                         Assert.assertEquals(ExchangePattern.InOut, e.getPattern());
+                        Boolean setException = (Boolean) e.getProperty("setException");
 
-                        e.getOut().setBody("Goodbye!");
-                        e.getOut().setHeader("cheese", "cheddar");
+                        if (setException) {
+                            e.getFault().setBody(new InterruptedException());
+                            e.getFault().setHeader("hello", "nihao");
+                        } else {
+                            e.getOut().setBody("Goodbye!");
+                            e.getOut().setHeader("cheese", "cheddar");
+                        }
                         e.setProperty("salami", "fresh");
                     }
                 });

Modified: activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaUdpWithInOutUsingPlainSocketTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaUdpWithInOutUsingPlainSocketTest.java?rev=690920&r1=690919&r2=690920&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaUdpWithInOutUsingPlainSocketTest.java
(original)
+++ activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaUdpWithInOutUsingPlainSocketTest.java
Mon Sep  1 02:29:48 2008
@@ -70,7 +70,7 @@
                 from("mina:udp://127.0.0.1:" + PORT + "?sync=true").process(new Processor()
{
                     public void process(Exchange exchange) throws Exception {
                         ByteBuffer in = exchange.getIn().getBody(ByteBuffer.class);
-                        String s = MinaConverter.toString(in);
+                        String s = MinaConverter.toString(in, exchange);
                         exchange.getOut().setBody("Hello " + s);
                     }
                 });



Mime
View raw message