camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1171948 - in /camel/branches/camel-2.8.x: ./ camel-core/src/main/java/org/apache/camel/impl/SerializationDataFormat.java camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
Date Sat, 17 Sep 2011 11:24:49 GMT
Author: davsclaus
Date: Sat Sep 17 11:24:49 2011
New Revision: 1171948

URL: http://svn.apache.org/viewvc?rev=1171948&view=rev
Log:
Merged revisions 1171947 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk


Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/SerializationDataFormat.java
    camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 11:24:49 2011
@@ -1 +1 @@
-/camel/trunk:1148706,1148710,1149570,1150651,1151000,1151054,1151087,1151362,1152170,1152755,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157749,1157798,1157831,1157878,1158153,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395,1163231,1163420,1164544,1164557,1164633,1164972-1165000,1165152,1165157,1165658,1165971,1165987,1167098,1167131,1167448,1167487,1167555,1169610,1169620,1170122,1170226,1170397,1170956,1171396,1171755,1171941
+/camel/trunk:1148706,1148710,1149570,1150651,1151000,1151054,1151087,1151362,1152170,1152755,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157749,1157798,1157831,1157878,1158153,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395,1163231,1163420,1164544,1164557,1164633,1164972-1165000,1165152,1165157,1165658,1165971,1165987,1167098,1167131,1167448,1167487,1167555,1169610,1169620,1170122,1170226,1170397,1170956,1171396,1171755,1171941,1171947

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/SerializationDataFormat.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/SerializationDataFormat.java?rev=1171948&r1=1171947&r2=1171948&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/SerializationDataFormat.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/SerializationDataFormat.java
Sat Sep 17 11:24:49 2011
@@ -34,8 +34,8 @@ import org.apache.camel.util.ExchangeHel
  */
 public class SerializationDataFormat implements DataFormat {
 
-    public void marshal(Exchange exchange, Object graph, OutputStream stream) throws IOException
{
-        ObjectOutput out = ExchangeHelper.convertToType(exchange, ObjectOutput.class, stream);
+    public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception
{
+        ObjectOutput out = ExchangeHelper.convertToMandatoryType(exchange, ObjectOutput.class,
stream);
         try {
             out.writeObject(graph);
         } finally {
@@ -48,8 +48,8 @@ public class SerializationDataFormat imp
         }
     }
 
-    public Object unmarshal(Exchange exchange, InputStream stream) throws IOException, ClassNotFoundException
{
-        ObjectInput in = ExchangeHelper.convertToType(exchange, ObjectInput.class, stream);
+    public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
+        ObjectInput in = ExchangeHelper.convertToMandatoryType(exchange, ObjectInput.class,
stream);
         try {
             return in.readObject();
         } finally {

Modified: camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java?rev=1171948&r1=1171947&r2=1171948&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
(original)
+++ camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
Sat Sep 17 11:24:49 2011
@@ -16,11 +16,14 @@
  */
 package org.apache.camel.processor;
 
+import java.io.NotSerializableException;
 import java.io.Serializable;
 
+import org.apache.camel.CamelExecutionException;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+
 import static org.apache.camel.util.ObjectHelper.equal;
 
 /**
@@ -41,6 +44,15 @@ public class DataFormatTest extends Cont
         resultEndpoint.assertIsSatisfied();
     }
 
+    public void testMarshalNonSerializableBean() throws Exception {
+        MyNonSerializableBean bean = new MyNonSerializableBean("James");
+        try {
+            template.sendBody("direct:start", bean);
+            fail("Should throw exception");
+        } catch (CamelExecutionException e) {
+            assertIsInstanceOf(NotSerializableException.class, e.getCause());
+        }
+    }
 
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
@@ -70,4 +82,12 @@ public class DataFormatTest extends Cont
         }
     }
 
+    protected static class MyNonSerializableBean {
+        private String name;
+
+        public MyNonSerializableBean(String name) {
+            this.name = name;
+        }
+    }
+
 }
\ No newline at end of file



Mime
View raw message