You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/05/31 07:24:50 UTC

svn commit: r410432 - /webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java

Author: deepal
Date: Tue May 30 22:24:49 2006
New Revision: 410432

URL: http://svn.apache.org/viewvc?rev=410432&view=rev
Log:
fixing AXIS2-778

Modified:
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java?rev=410432&r1=410431&r2=410432&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java Tue May 30 22:24:49 2006
@@ -153,15 +153,15 @@
      *                                      into this <CODE>AttachmentPart</CODE> object or if there
      *                                      was a data transformation error
      */
-     public Object getContent() throws SOAPException {
+    public Object getContent() throws SOAPException {
         if (dataHandler == null) {
             throw new SOAPException("No content is present in this AttachmentPart");
         }
         try {
             String contentType = dataHandler.getContentType();
             if (contentType.equals("text/plain") ||
-                contentType.equals("text/xml") ||
-                contentType.equals("text/html")) {
+                    contentType.equals("text/xml") ||
+                    contentType.equals("text/html")) {
 
                 //For these content types underlying DataContentHandler surely does
                 //the conversion to appropriate java object and we will return that java object
@@ -209,8 +209,8 @@
                 String s = (String) object;
                 java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(s.getBytes());
                 source = new SAAJDataSource(bais,
-                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
-                                            contentType, true);
+                        SAAJDataSource.MAX_MEMORY_DISK_CACHED,
+                        contentType, true);
                 extractFilename(source);
                 dataHandler = new DataHandler(source);
                 contentObject = object;
@@ -220,8 +220,8 @@
         } else if (object instanceof java.io.InputStream) {
             try {
                 source = new SAAJDataSource((java.io.InputStream) object,
-                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
-                                            contentType, true);
+                        SAAJDataSource.MAX_MEMORY_DISK_CACHED,
+                        contentType, true);
                 extractFilename(source);
                 dataHandler = new DataHandler(source);
                 contentObject = null; // the stream has been consumed
@@ -231,8 +231,8 @@
         } else if (object instanceof StreamSource) {
             try {
                 source = new SAAJDataSource(((StreamSource) object).getInputStream(),
-                                            SAAJDataSource.MAX_MEMORY_DISK_CACHED,
-                                            contentType, true);
+                        SAAJDataSource.MAX_MEMORY_DISK_CACHED,
+                        contentType, true);
                 extractFilename(source);
                 dataHandler = new DataHandler(source);
                 contentObject = null; // the stream has been consumed
@@ -254,9 +254,14 @@
      *                                      no data in this <CODE>AttachmentPart</CODE> object
      */
     public DataHandler getDataHandler() throws SOAPException {
-        if (getContent() == null) {
+//        if (getContent() == null) {
+//            throw new SOAPException("No Content present in the Attachment part");
+//        }
+        //commented to fix AXIS2-778
+        if (dataHandler == null) {
             throw new SOAPException("No Content present in the Attachment part");
         }
+
         return dataHandler;
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org