You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/05/22 03:15:52 UTC

svn commit: r658966 - /activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConverter.java

Author: ningjiang
Date: Wed May 21 18:15:52 2008
New Revision: 658966

URL: http://svn.apache.org/viewvc?rev=658966&view=rev
Log:
Added a try catch in the MinaConverter to fix the build failure in my windows box

Modified:
    activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConverter.java

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=658966&r1=658965&r2=658966&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 Wed May 21 18:15:52 2008
@@ -37,9 +37,13 @@
     @Converter
     public static byte[] toByteArray(ByteBuffer buffer) {
         byte[] answer = new byte[buffer.remaining()];
+        try {
+            // must acquire the Byte buffer to avoid release if more than twice
+            buffer.acquire();
+        } catch (IllegalStateException ex) {
+            // catch the exception if we acquire the buffer which is already released.
+        }
         buffer.get(answer);
-        // must acquire the Byte buffer to avoid release if more than twice
-        buffer.acquire();
         return answer;
     }
 
@@ -61,6 +65,7 @@
 
     @Converter
     public static ByteBuffer toByteBuffer(byte[] bytes) {
+        System.out.println("calling to ByteBuffer");
         ByteBuffer buf = ByteBuffer.allocate(bytes.length);
         buf.put(bytes);
         return buf;