camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1233271 - in /camel/branches/camel-2.9.x: ./ camel-core/src/main/java/org/apache/camel/converter/ camel-core/src/test/java/org/apache/camel/impl/ components/camel-http/
Date Thu, 19 Jan 2012 10:33:22 GMT
Author: davsclaus
Date: Thu Jan 19 10:33:21 2012
New Revision: 1233271

URL: http://svn.apache.org/viewvc?rev=1233271&view=rev
Log:
CAMEL-4915: Serialization data format should use ClassResolver API from Camel to work with
other runtimes.

Added:
    camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/impl/MySerialBean.java
      - copied unchanged from r1233259, camel/trunk/camel-core/src/test/java/org/apache/camel/impl/MySerialBean.java
    camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/impl/SerializationDataFormatTest.java
      - copied unchanged from r1233259, camel/trunk/camel-core/src/test/java/org/apache/camel/impl/SerializationDataFormatTest.java
Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java
    camel/branches/camel-2.9.x/components/camel-http/   (props changed)

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 19 10:33:21 2012
@@ -1 +1 @@
-/camel/trunk:1227209,1227212,1227540,1228015,1228027,1228223,1228879,1229565,1231135,1231704,1232309,1232312,1232429,1232763,1232782,1232834,1233183
+/camel/trunk:1227209,1227212,1227540,1228015,1228027,1228223,1228879,1229565,1231135,1231704,1232309,1232312,1232429,1232763,1232782,1232834,1233183,1233259

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 19 10:33:21 2012
@@ -1 +1 @@
-/camel/trunk:1-1227196,1227209,1227212,1227540,1228015,1228027,1228223,1228879,1229565,1231135,1231704,1232309,1232312,1232429,1232763,1232782,1232834,1233183
+/camel/trunk:1-1227196,1227209,1227212,1227540,1228015,1228027,1228223,1228879,1229565,1231135,1231704,1232309,1232312,1232429,1232763,1232782,1232834,1233183,1233259

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java?rev=1233271&r1=1233270&r2=1233271&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java
Thu Jan 19 10:33:21 2012
@@ -31,6 +31,7 @@ import java.io.ObjectInput;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutput;
 import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Reader;
@@ -326,11 +327,28 @@ public final class IOConverter {
     }
 
     @Converter
-    public static ObjectInput toObjectInput(InputStream stream) throws IOException {
+    public static ObjectInput toObjectInput(final InputStream stream, final Exchange exchange)
throws IOException {
         if (stream instanceof ObjectInput) {
             return (ObjectInput) stream;
         } else {
-            return new ObjectInputStream(IOHelper.buffered(stream));
+            return new ObjectInputStream(IOHelper.buffered(stream)) {
+                @Override
+                protected Class<?> resolveClass(ObjectStreamClass objectStreamClass)
throws IOException, ClassNotFoundException {
+                    // need to let Camel be able to resolve class using ClassResolver SPI,
to let class loading
+                    // work in OSGi and other runtimes
+                    Class<?>  answer = null;
+                    String name = objectStreamClass.getName();
+                    if (exchange != null) {
+                        LOG.trace("Loading class {} using Camel ClassResolver", name);
+                        answer = exchange.getContext().getClassResolver().resolveClass(name);
+                    }
+                    if (answer == null) {
+                        LOG.trace("Loading class {} using JDK default implementation", name);
+                        answer = super.resolveClass(objectStreamClass);
+                    }
+                    return answer;
+                }
+            };
         }
     }
 

Propchange: camel/branches/camel-2.9.x/components/camel-http/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 19 10:33:21 2012
@@ -1 +1 @@
-/camel/trunk/components/camel-http:917526,1227209,1227212,1228015,1228027,1228223,1228879,1232782,1232834
+/camel/trunk/components/camel-http:917526,1227209,1227212,1228015,1228027,1228223,1228879,1232782,1232834,1233259



Mime
View raw message