camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r740306 - in /camel/trunk/components/camel-jaxb: pom.xml src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java src/test/java/org/apache/camel/example/JAXBConverterMessageTypeTest.java
Date Tue, 03 Feb 2009 14:01:10 GMT
Author: davsclaus
Date: Tue Feb  3 14:01:10 2009
New Revision: 740306

URL: http://svn.apache.org/viewvc?rev=740306&view=rev
Log:
CAMEL-1271: Fixed spring-jaxb should skip StreamCache types in fallback type converter.

Modified:
    camel/trunk/components/camel-jaxb/pom.xml
    camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
    camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/example/JAXBConverterMessageTypeTest.java

Modified: camel/trunk/components/camel-jaxb/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jaxb/pom.xml?rev=740306&r1=740305&r2=740306&view=diff
==============================================================================
--- camel/trunk/components/camel-jaxb/pom.xml (original)
+++ camel/trunk/components/camel-jaxb/pom.xml Tue Feb  3 14:01:10 2009
@@ -113,8 +113,6 @@
                     <forkMode>pertest</forkMode>
                     <excludes>
                         <!-- TODO FIXME ASAP -->
-                        <exclude>**/DataFormatTest.*</exclude>
-                        <exclude>**/SpringDataFormat*Test.*</exclude>
                     </excludes>
                 </configuration>
             </plugin>

Modified: camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java?rev=740306&r1=740305&r2=740306&view=diff
==============================================================================
--- camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
(original)
+++ camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
Tue Feb  3 14:01:10 2009
@@ -16,8 +16,11 @@
  */
 package org.apache.camel.converter.jaxb;
 
-import java.io.*;
-
+import java.io.Closeable;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
@@ -30,6 +33,7 @@
 import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.TypeConverter;
+import org.apache.camel.converter.stream.StreamCache;
 import org.apache.camel.spi.TypeConverterAware;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
@@ -61,7 +65,7 @@
                 return unmarshall(type, value);
             }
             if (value != null) {
-                if (isJaxbType(value.getClass())) {
+                if (isJaxbType(value.getClass()) && isNotStreamCacheType(type)) {
                     return marshall(type, value);
                 }
             }
@@ -71,6 +75,10 @@
         }
     }
 
+    private <T> boolean isNotStreamCacheType(Class<T> type) {
+        return !StreamCache.class.isAssignableFrom(type);
+    }
+
     public <T> T convertTo(Class<T> type, Exchange exchange, Object value) {
         return convertTo(type, value);
     }

Modified: camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/example/JAXBConverterMessageTypeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/example/JAXBConverterMessageTypeTest.java?rev=740306&r1=740305&r2=740306&view=diff
==============================================================================
--- camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/example/JAXBConverterMessageTypeTest.java
(original)
+++ camel/trunk/components/camel-jaxb/src/test/java/org/apache/camel/example/JAXBConverterMessageTypeTest.java
Tue Feb  3 14:01:10 2009
@@ -31,12 +31,8 @@
     protected TypeConverter converter = context.getTypeConverter();
 
     public void testConverter() throws Exception {
-        // TODO: fails see CAMEL-583
-        /*
         MessageType message = converter.convertTo(MessageType.class, "<message><hello>bar</hello></message>");
-
         assertNotNull("Message should not be null!", message);
-        */
     }
 
 }



Mime
View raw message