Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0C99B85CA for ; Sat, 17 Sep 2011 11:25:11 +0000 (UTC) Received: (qmail 6169 invoked by uid 500); 17 Sep 2011 11:25:11 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 6131 invoked by uid 500); 17 Sep 2011 11:25:10 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 6121 invoked by uid 99); 17 Sep 2011 11:25:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Sep 2011 11:25:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Sep 2011 11:25:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8C71123889E2 for ; Sat, 17 Sep 2011 11:24:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@camel.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20110917112449.8C71123889E2@eris.apache.org> 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