ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1796660 - in /webservices/axiom/trunk: aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/ axiom-api/src/main/java/org/apache/axiom/attachments/ axiom-api/src/main/java/org/apache/axiom/mime/
Date Mon, 29 May 2017 16:14:48 GMT
Author: veithen
Date: Mon May 29 16:14:48 2017
New Revision: 1796660

URL: http://svn.apache.org/viewvc?rev=1796660&view=rev
Log:
Fix TODO item.

Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/BuilderSpec.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentStreams.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/attachments/MultipartBodyAdapter.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/Part.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/PartImpl.java

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/BuilderSpec.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/BuilderSpec.java?rev=1796660&r1=1796659&r2=1796660&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/BuilderSpec.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/BuilderSpec.java
Mon May 29 16:14:48 2017
@@ -188,12 +188,7 @@ final class BuilderSpec {
 
     static BuilderSpec from(StAXParserConfiguration configuration, final MultipartBody message)
{
         Part rootPart = message.getRootPart();
-        InputSource is;
-        try {
-            is = new InputSource(rootPart.getInputStream(false));
-        } catch (IOException ex) {
-            throw new OMException(ex);
-        }
+        InputSource is = new InputSource(rootPart.getInputStream(false));
         is.setEncoding(rootPart.getContentType().getParameter("charset"));
         BuilderSpec spec = create(configuration, is, false);
         return new BuilderSpec(

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentStreams.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentStreams.java?rev=1796660&r1=1796659&r2=1796660&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentStreams.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentStreams.java
Mon May 29 16:14:48 2017
@@ -19,7 +19,6 @@
 
 package org.apache.axiom.attachments;
 
-import java.io.IOException;
 import java.util.Iterator;
 
 import org.apache.axiom.mime.Header;
@@ -81,13 +80,7 @@ public final class IncomingAttachmentStr
         }
 
         if (part != null) {
-            IncomingAttachmentInputStream stream;
-
-            try {
-                stream = new IncomingAttachmentInputStream(part.getInputStream(false), this);
-            } catch (IOException ex) {
-                throw new OMException(ex);
-            }
+            IncomingAttachmentInputStream stream =  new IncomingAttachmentInputStream(part.getInputStream(false),
this);
     
             for (Header header : part.getHeaders()) {
                 String name = header.getName();

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/attachments/MultipartBodyAdapter.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/attachments/MultipartBodyAdapter.java?rev=1796660&r1=1796659&r2=1796660&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/attachments/MultipartBodyAdapter.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/attachments/MultipartBodyAdapter.java
Mon May 29 16:14:48 2017
@@ -162,11 +162,7 @@ final class MultipartBodyAdapter extends
 
     @Override
     InputStream getRootPartInputStream(boolean preserve) {
-        try {
-            return rootPart.getInputStream(preserve);
-        } catch (IOException ex) {
-            throw new OMException("Problem fetching the root part", ex);
-        }
+        return rootPart.getInputStream(preserve);
     }
 
     @Override

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/Part.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/Part.java?rev=1796660&r1=1796659&r2=1796660&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/Part.java (original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/Part.java Mon May
29 16:14:48 2017
@@ -18,7 +18,6 @@
  */
 package org.apache.axiom.mime;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.util.List;
 
@@ -77,11 +76,8 @@ public interface Part {
      *            {@code true} if the content should be preserved so that it can be read
multiple
      *            times, {@code false} to discard the content when it is read
      * @return the content of the part
-     * @throws IOException
-     *             if the content couldn't be read
      */
-    // TODO: should we really use IOException here?
-    InputStream getInputStream(boolean preserve) throws IOException;
+    InputStream getInputStream(boolean preserve);
 
     /**
      * Get the content of this part as a {@link DataHandler}.

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/PartImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/PartImpl.java?rev=1796660&r1=1796659&r2=1796660&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/PartImpl.java (original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/PartImpl.java Mon
May 29 16:14:48 2017
@@ -240,7 +240,7 @@ final class PartImpl implements Part {
     }
     
     @Override
-    public InputStream getInputStream(boolean preserve) throws IOException {
+    public InputStream getInputStream(boolean preserve) {
         if (!preserve && state == STATE_UNREAD) {
             checkParserState(parser.getState(), EntityState.T_BODY);
             state = STATE_STREAMING;
@@ -248,10 +248,14 @@ final class PartImpl implements Part {
             return partInputStream;
         } else {
             WritableBlob content = getContent();
-            if (preserve) {
-                return content.getInputStream();
-            } else {
-                return new PartInputStream(content);
+            try {
+                if (preserve) {
+                    return content.getInputStream();
+                } else {
+                    return new PartInputStream(content);
+                }
+            } catch (IOException ex) {
+                throw new MIMEException("Failed to retrieve part content from blob", ex);
             }
         }
     }



Mime
View raw message