--- old/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java 2017-06-01 18:20:52.693569706 +0100 +++ new/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeMultipart.java 2017-06-01 18:20:52.633569707 +0100 @@ -31,16 +31,22 @@ package com.sun.xml.internal.messaging.saaj.packaging.mime.internet; -import java.io.*; - -import javax.activation.DataSource; - -import com.sun.xml.internal.messaging.saaj.packaging.mime.*; -import com.sun.xml.internal.messaging.saaj.packaging.mime.util.*; -import com.sun.xml.internal.messaging.saaj.util.FinalArrayList; +import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException; +import com.sun.xml.internal.messaging.saaj.packaging.mime.MultipartDataSource; +import com.sun.xml.internal.messaging.saaj.packaging.mime.util.ASCIIUtility; +import com.sun.xml.internal.messaging.saaj.packaging.mime.util.LineInputStream; +import com.sun.xml.internal.messaging.saaj.packaging.mime.util.OutputUtil; import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; +import com.sun.xml.internal.messaging.saaj.util.FinalArrayList; import com.sun.xml.internal.messaging.saaj.util.SAAJUtil; +import javax.activation.DataSource; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + /** * The MimeMultipart class is an implementation * that uses MIME conventions for the multipart data.

@@ -211,7 +217,7 @@ * @exception MessagingException if no such MimeBodyPart exists */ public MimeBodyPart getBodyPart(int index) - throws MessagingException { + throws MessagingException { parse(); if (parts == null) throw new IndexOutOfBoundsException("No such BodyPart"); @@ -228,19 +234,19 @@ * @exception MessagingException if no such MimeBodyPart exists. */ public MimeBodyPart getBodyPart(String CID) - throws MessagingException { + throws MessagingException { parse(); int count = getCount(); for (int i = 0; i < count; i++) { MimeBodyPart part = getBodyPart(i); String s = part.getContentID(); - // Old versions of AXIS2 put angle brackets around the content - // id but not the start param - String sNoAngle = (s!= null) ? s.replaceFirst("^<", "").replaceFirst(">$", "") - :null; + // Old versions of AXIS2 put angle brackets around the content + // id but not the start param + String sNoAngle = (s!= null) ? s.replaceFirst("^<", "").replaceFirst(">$", "") + :null; if (s != null && (s.equals(CID) || CID.equals(sNoAngle))) - return part; + return part; } return null; } @@ -319,14 +325,14 @@ try { in = ds.getInputStream(); if (!(in instanceof ByteArrayInputStream) && - !(in instanceof BufferedInputStream) && - !(in instanceof SharedInputStream)) + !(in instanceof BufferedInputStream) && + !(in instanceof SharedInputStream)) in = new BufferedInputStream(in); } catch (Exception ex) { throw new MessagingException("No inputstream from datasource"); } if (in instanceof SharedInputStream) - sin = (SharedInputStream)in; + sin = (SharedInputStream) in; String boundary = "--" + contentType.getParameter("boundary"); byte[] bndbytes = ASCIIUtility.getBytes(boundary); @@ -338,12 +344,12 @@ LineInputStream lin = new LineInputStream(in); String line; while ((line = lin.readLine()) != null) { - /* - * Strip trailing whitespace. Can't use trim method - * because it's too aggressive. Some bogus MIME - * messages will include control characters in the - * boundary string. - */ + /* + * Strip trailing whitespace. Can't use trim method + * because it's too aggressive. Some bogus MIME + * messages will include control characters in the + * boundary string. + */ int i; for (i = line.length() - 1; i >= 0; i--) { char c = line.charAt(i); @@ -357,12 +363,12 @@ if (line == null) throw new MessagingException("Missing start boundary"); - /* - * Read and process body parts until we see the - * terminating boundary line (or EOF). - */ + /* + * Read and process body parts until we see the + * terminating boundary line (or EOF). + */ boolean done = false; - getparts: + getparts: while (!done) { InternetHeaders headers = null; if (sin != null) { @@ -372,7 +378,7 @@ ; if (line == null) { if (!ignoreMissingEndBoundary) { - throw new MessagingException("Missing End Boundary for Mime Package : EOF while skipping headers"); + throw new MessagingException("Missing End Boundary for Mime Package : EOF while skipping headers"); } // assume there's just a missing end boundary break getparts; @@ -397,7 +403,7 @@ /* * Read and save the content bytes in buf. */ - for (;;) { + for (; ; ) { if (bol) { /* * At the beginning of a line, check whether the @@ -416,7 +422,7 @@ if (in.read() == '-') { done = true; foundClosingBoundary = true; - break; // ignore trailing text + break; // ignore trailing text } } // skip linear whitespace @@ -424,12 +430,12 @@ b2 = in.read(); // check for end of line if (b2 == '\n') - break; // got it! break out of the loop + break; // got it! break out of the loop if (b2 == '\r') { in.mark(1); if (in.read() != '\n') in.reset(); - break; // got it! break out of the loop + break; // got it! break out of the loop } } // failed to match, reset and proceed normally @@ -491,7 +497,7 @@ buf.close(); } - if (!ignoreMissingEndBoundary && !foundClosingBoundary && sin== null) { + if (!ignoreMissingEndBoundary && !foundClosingBoundary && sin == null) { throw new MessagingException("Missing End Boundary for Mime Package : EOF while skipping headers"); } parsed = true; @@ -510,7 +516,7 @@ * @since JavaMail 1.2 */ protected InternetHeaders createInternetHeaders(InputStream is) - throws MessagingException { + throws MessagingException { return new InternetHeaders(is); } @@ -523,12 +529,12 @@ * * @param headers the headers for the body part. * @param content the content of the body part. - * @param len the content length. + * @param len the content length. * @return MimeBodyPart * @since JavaMail 1.2 */ protected MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte[] content, int len) { - return new MimeBodyPart(headers, content,len); + return new MimeBodyPart(headers, content,len); } /** @@ -544,7 +550,7 @@ * @since JavaMail 1.2 */ protected MimeBodyPart createMimeBodyPart(InputStream is) throws MessagingException { - return new MimeBodyPart(is); + return new MimeBodyPart(is); } /** @@ -564,7 +570,7 @@ * @exception MessagingException in case of error. */ protected void setMultipartDataSource(MultipartDataSource mp) - throws MessagingException { + throws MessagingException { contentType = new ContentType(mp.getContentType()); int count = mp.getCount(); @@ -582,7 +588,7 @@ * @see #contentType */ public ContentType getContentType() { - return contentType; + return contentType; } /**