You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by lh...@apache.org on 2008/03/28 15:37:44 UTC

svn commit: r642243 - /servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java

Author: lhein
Date: Fri Mar 28 07:37:39 2008
New Revision: 642243

URL: http://svn.apache.org/viewvc?rev=642243&view=rev
Log:
- reverted the usage of FileDataSource (see SM-1295) because it breaks the FTP polling logic

Modified:
    servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java

Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java?rev=642243&r1=642242&r2=642243&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java Fri Mar 28 07:37:39 2008
@@ -22,14 +22,13 @@
 import java.io.OutputStream;
 
 import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import javax.activation.FileDataSource;
 import javax.jbi.JBIException;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 
 import org.apache.servicemix.jbi.util.FileUtil;
+import org.apache.servicemix.jbi.util.StreamDataSource;
 
 /**
  * A FileMarshaler that converts the given input stream into a binary
@@ -84,8 +83,7 @@
     public void readMessage(MessageExchange exchange, NormalizedMessage message, InputStream in, String path)
         throws IOException, JBIException {
         File polledFile = new File(path);
-        DataSource ds = new FileDataSource(polledFile);
-        DataHandler handler = new DataHandler(ds);
+        DataHandler handler = new DataHandler(new StreamDataSource(in));
         message.addAttachment(attachment, handler);
         message.setProperty(FILE_NAME_PROPERTY, polledFile.getName());
         message.setProperty(FILE_PATH_PROPERTY, path);