< prev index next >

src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java

Print this page

        

*** 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 --- 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
*** 81,91 **** protected static final int FI_ENCODED_FLAG = 16; // 10000 protected MimeHeaders headers; protected ContentType contentType; protected SOAPPartImpl soapPartImpl; ! protected FinalArrayList attachments; protected boolean saved = false; protected byte[] messageBytes; protected int messageByteCount; protected HashMap properties = new HashMap(); --- 81,91 ---- protected static final int FI_ENCODED_FLAG = 16; // 10000 protected MimeHeaders headers; protected ContentType contentType; protected SOAPPartImpl soapPartImpl; ! protected FinalArrayList<AttachmentPart> attachments; protected boolean saved = false; protected byte[] messageBytes; protected int messageByteCount; protected HashMap properties = new HashMap();
*** 853,863 **** this.optimizeAttachmentProcessing = true; } catch (Exception e) { throw new RuntimeException(e); } if (attachments == null) ! attachments = new FinalArrayList(); attachments.add(attachment); needsSave(); } --- 853,863 ---- this.optimizeAttachmentProcessing = true; } catch (Exception e) { throw new RuntimeException(e); } if (attachments == null) ! attachments = new FinalArrayList<AttachmentPart>(); attachments.add(attachment); needsSave(); }
*** 885,924 **** ct.setSubType(split[1]); ct.setParameter("charset", charset); headers.setHeader("Content-Type", ct.toString()); } ! private class MimeMatchingIterator implements Iterator { public MimeMatchingIterator(MimeHeaders headers) { this.headers = headers; this.iter = attachments.iterator(); } ! private Iterator iter; private MimeHeaders headers; ! private Object nextAttachment; public boolean hasNext() { if (nextAttachment == null) nextAttachment = nextMatch(); return nextAttachment != null; } ! public Object next() { if (nextAttachment != null) { ! Object ret = nextAttachment; nextAttachment = null; return ret; } if (hasNext()) return nextAttachment; return null; } ! Object nextMatch() { while (iter.hasNext()) { AttachmentPartImpl ap = (AttachmentPartImpl) iter.next(); if (ap.hasAllHeaders(headers)) return ap; } --- 885,924 ---- ct.setSubType(split[1]); ct.setParameter("charset", charset); headers.setHeader("Content-Type", ct.toString()); } ! private class MimeMatchingIterator implements Iterator<AttachmentPart> { public MimeMatchingIterator(MimeHeaders headers) { this.headers = headers; this.iter = attachments.iterator(); } ! private Iterator<AttachmentPart> iter; private MimeHeaders headers; ! private AttachmentPart nextAttachment; public boolean hasNext() { if (nextAttachment == null) nextAttachment = nextMatch(); return nextAttachment != null; } ! public AttachmentPart next() { if (nextAttachment != null) { ! AttachmentPart ret = nextAttachment; nextAttachment = null; return ret; } if (hasNext()) return nextAttachment; return null; } ! AttachmentPart nextMatch() { while (iter.hasNext()) { AttachmentPartImpl ap = (AttachmentPartImpl) iter.next(); if (ap.hasAllHeaders(headers)) return ap; }
*** 949,964 **** throw new RuntimeException(e); } if (attachments == null) return ; ! Iterator it = new MimeMatchingIterator(headers); while (it.hasNext()) { int index = attachments.indexOf(it.next()); attachments.set(index, null); } ! FinalArrayList f = new FinalArrayList(); for (int i = 0; i < attachments.size(); i++) { if (attachments.get(i) != null) { f.add(attachments.get(i)); } } --- 949,964 ---- throw new RuntimeException(e); } if (attachments == null) return ; ! Iterator<AttachmentPart> it = new MimeMatchingIterator(headers); while (it.hasNext()) { int index = attachments.indexOf(it.next()); attachments.set(index, null); } ! FinalArrayList<AttachmentPart> f = new FinalArrayList<AttachmentPart>(); for (int i = 0; i < attachments.size(); i++) { if (attachments.get(i) != null) { f.add(attachments.get(i)); } }
*** 1064,1074 **** SOAPPartImpl sp = (SOAPPartImpl) getSOAPPart(); return sp.getContentAsStream(); } private String convertToSingleLine(String contentType) { ! StringBuffer buffer = new StringBuffer(); for (int i = 0; i < contentType.length(); i ++) { char c = contentType.charAt(i); if (c != '\r' && c != '\n' && c != '\t') buffer.append(c); } --- 1064,1074 ---- SOAPPartImpl sp = (SOAPPartImpl) getSOAPPart(); return sp.getContentAsStream(); } private String convertToSingleLine(String contentType) { ! StringBuilder buffer = new StringBuilder(); for (int i = 0; i < contentType.length(); i ++) { char c = contentType.charAt(i); if (c != '\r' && c != '\n' && c != '\t') buffer.append(c); }
*** 1096,1106 **** if (!switchOffBM && !switchOffLazyAttachment && (multiPart != null) && !attachmentsInitialized) { headerAndBody = new BMMimeMultipart(); headerAndBody.addBodyPart(mimeSoapPart); if (attachments != null) { ! for (Iterator eachAttachment = attachments.iterator(); eachAttachment.hasNext();) { headerAndBody.addBodyPart( ((AttachmentPartImpl) eachAttachment.next()) .getMimePart()); } --- 1096,1106 ---- if (!switchOffBM && !switchOffLazyAttachment && (multiPart != null) && !attachmentsInitialized) { headerAndBody = new BMMimeMultipart(); headerAndBody.addBodyPart(mimeSoapPart); if (attachments != null) { ! for (Iterator<AttachmentPart> eachAttachment = attachments.iterator(); eachAttachment.hasNext();) { headerAndBody.addBodyPart( ((AttachmentPartImpl) eachAttachment.next()) .getMimePart()); }
*** 1422,1432 **** if (attachmentsInitialized || (multiPart == null)) { return; } if (attachments == null) ! attachments = new FinalArrayList(); int count = multiPart.getCount(); for (int i=0; i < count; i++ ) { initializeAttachment(multiPart.getBodyPart(i)); } --- 1422,1432 ---- if (attachmentsInitialized || (multiPart == null)) { return; } if (attachments == null) ! attachments = new FinalArrayList<AttachmentPart>(); int count = multiPart.getCount(); for (int i=0; i < count; i++ ) { initializeAttachment(multiPart.getBodyPart(i)); }
< prev index next >