You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2008/12/06 17:41:02 UTC

svn commit: r724005 - /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java

Author: veithen
Date: Sat Dec  6 08:41:02 2008
New Revision: 724005

URL: http://svn.apache.org/viewvc?rev=724005&view=rev
Log:
WSCOMMONS-386: Throw an exception if the "boundary" parameter is not found. Indeed, it makes no sense to let the MIME parser look for "--null".

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java?rev=724005&r1=724004&r2=724005&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java Sat Dec  6 08:41:02 2008
@@ -191,8 +191,11 @@
             if(encoding == null || encoding.length()==0){
                 encoding = "UTF-8";
             }
-            this.boundary = ("--" + contentType.getParameter("boundary"))
-                    .getBytes(encoding);
+            String boundaryParam = contentType.getParameter("boundary");
+            if (boundaryParam == null) {
+                throw new OMException("Content-type has no 'boundary' parameter");
+            }
+            this.boundary = ("--" + boundaryParam).getBytes(encoding);
             if (log.isDebugEnabled()) {
                 log.debug("boundary=" + new String(this.boundary));
             }