Author: dkulp
Date: Mon Jul  7 12:18:53 2008
New Revision: 674601

URL: http://svn.apache.org/viewvc?rev=674601&view=rev
Log:
[CXF-1665] Remove dead code, try to map byte[] as well.

Modified:
    
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java

Modified: 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java?rev=674601&r1=674600&r2=674601&view=diff
==============================================================================
--- 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java
 (original)
+++ 
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAOutInterceptor.java
 Mon Jul  7 12:18:53 2008
@@ -35,7 +35,6 @@
 
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
-import javax.activation.URLDataSource;
 import javax.imageio.ImageIO;
 import javax.imageio.ImageWriter;
 import javax.imageio.stream.ImageOutputStream;
@@ -149,9 +148,7 @@
             
             // This code could probably be refactored out somewhere...
             if (o instanceof Source) {
-                
                 dh = new DataHandler(createDataSource((Source)o, ct));
-                
             } else if (o instanceof Image) {
                 // TODO: make this streamable. This is one of my pet
                 // peeves in JAXB RI as well, so if you fix this, submit the 
@@ -191,13 +188,14 @@
                 } catch (IOException e) {
                     //ignore, use same dh
                 }
-            } else if (dh == null) {
+            } else if (o instanceof byte[]) {
+                if (ct == null) {
+                    ct = "application/octet-stream";
+                }
+                dh = new DataHandler(new ByteArrayDataSource((byte[])o, ct));  
              
+            } else {
                 throw new Fault(new 
org.apache.cxf.common.i18n.Message("ATTACHMENT_NOT_SUPPORTED", 
                                                                        LOG, 
o.getClass()));
-            } else if (dh.getDataSource() instanceof URLDataSource) {
-                URLDataSource ds = (URLDataSource)dh.getDataSource();
-                dh = new DataHandler(ds.getURL()); 
-                ct = ds.getContentType();
             }
             
             AttachmentImpl att = new AttachmentImpl(id);


Reply via email to