src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/BMMimeMultipart.java

Print this page
rev 447 : 8029237: Update copyright year to match last edit in jdk8 jaxws repository (2013)
Summary: Fixing Copyrights for year 2013
Reviewed-by: chegar
rev 472 : 8036030: Update JAX-WS RI integration to latest version

*** 1,7 **** /* ! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 38,48 **** 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.ByteOutputStream; - import com.sun.xml.internal.messaging.saaj.util.FinalArrayList; /** * The MimeMultipart class is an implementation of the abstract Multipart * class that uses MIME conventions for the multipart data. <p> * --- 38,47 ----
*** 391,407 **** public boolean find(InputStream is, byte[] pattern, SharedInputStream sin) throws Exception { int i; int l = pattern.length; int lx = l -1; - int bufferLength = 0; BitSet eof = new BitSet(1); long[] posVector = new long[1]; while (true) { is.mark(l); ! bufferLength = readNext(is, buffer, l, eof, posVector, sin); if (eof.get(0)) { // End of stream return false; } --- 390,405 ---- public boolean find(InputStream is, byte[] pattern, SharedInputStream sin) throws Exception { int i; int l = pattern.length; int lx = l -1; BitSet eof = new BitSet(1); long[] posVector = new long[1]; while (true) { is.mark(l); ! readNext(is, buffer, l, eof, posVector, sin); if (eof.get(0)) { // End of stream return false; }
*** 559,569 **** if ((s > 0) && (sin == null)) { if (prevBuffer[s-1] == (byte)13) { // if buffer[0] == (byte)10 if (buffer[0] == (byte)10) { ! int j=lx-1; for(j = lx-1; j > 0; j--) { if (buffer[j+1] != pattern[j]) { break; } } --- 557,567 ---- if ((s > 0) && (sin == null)) { if (prevBuffer[s-1] == (byte)13) { // if buffer[0] == (byte)10 if (buffer[0] == (byte)10) { ! int j; for(j = lx-1; j > 0; j--) { if (buffer[j+1] != pattern[j]) { break; } }
*** 693,703 **** /** * Iterates through all the parts and outputs each Mime part * separated by a boundary. */ - byte[] buf = new byte[1024]; public void writeTo(OutputStream os) throws IOException, MessagingException { // inputStream was not null --- 691,700 ----
*** 713,730 **** } if (in != null) { OutputUtil.writeln(bnd, os); // put out boundary if ((os instanceof ByteOutputStream) && lazyAttachments) { ! ((ByteOutputStream)os).write(in); } else { ! ByteOutputStream baos = new ByteOutputStream(in.available()); baos.write(in); baos.writeTo(os); // reset the inputstream so that we can support a ! //getAttachment later in = baos.newInputStream(); } // this will endup writing the end boundary } else { // put out last boundary --- 710,733 ---- } if (in != null) { OutputUtil.writeln(bnd, os); // put out boundary if ((os instanceof ByteOutputStream) && lazyAttachments) { ! ((ByteOutputStream) os).write(in); } else { ! ByteOutputStream baos = null; ! try { ! baos = new ByteOutputStream(in.available()); baos.write(in); baos.writeTo(os); // reset the inputstream so that we can support a ! // getAttachment later in = baos.newInputStream(); + } finally { + if (baos != null) + baos.close(); + } } // this will endup writing the end boundary } else { // put out last boundary