< prev index next >
src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/MessageImpl.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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,11 +81,11 @@
protected static final int FI_ENCODED_FLAG = 16; // 10000
protected MimeHeaders headers;
protected ContentType contentType;
protected SOAPPartImpl soapPartImpl;
- protected FinalArrayList attachments;
+ protected FinalArrayList<AttachmentPart> attachments;
protected boolean saved = false;
protected byte[] messageBytes;
protected int messageByteCount;
protected HashMap properties = new HashMap();
@@ -853,11 +853,11 @@
this.optimizeAttachmentProcessing = true;
} catch (Exception e) {
throw new RuntimeException(e);
}
if (attachments == null)
- attachments = new FinalArrayList();
+ attachments = new FinalArrayList<AttachmentPart>();
attachments.add(attachment);
needsSave();
}
@@ -885,40 +885,40 @@
ct.setSubType(split[1]);
ct.setParameter("charset", charset);
headers.setHeader("Content-Type", ct.toString());
}
- private class MimeMatchingIterator implements Iterator {
+ private class MimeMatchingIterator implements Iterator<AttachmentPart> {
public MimeMatchingIterator(MimeHeaders headers) {
this.headers = headers;
this.iter = attachments.iterator();
}
- private Iterator iter;
+ private Iterator<AttachmentPart> iter;
private MimeHeaders headers;
- private Object nextAttachment;
+ private AttachmentPart nextAttachment;
public boolean hasNext() {
if (nextAttachment == null)
nextAttachment = nextMatch();
return nextAttachment != null;
}
- public Object next() {
+ public AttachmentPart next() {
if (nextAttachment != null) {
- Object ret = nextAttachment;
+ AttachmentPart ret = nextAttachment;
nextAttachment = null;
return ret;
}
if (hasNext())
return nextAttachment;
return null;
}
- Object nextMatch() {
+ AttachmentPart nextMatch() {
while (iter.hasNext()) {
AttachmentPartImpl ap = (AttachmentPartImpl) iter.next();
if (ap.hasAllHeaders(headers))
return ap;
}
@@ -949,16 +949,16 @@
throw new RuntimeException(e);
}
if (attachments == null)
return ;
- Iterator it = new MimeMatchingIterator(headers);
+ Iterator<AttachmentPart> it = new MimeMatchingIterator(headers);
while (it.hasNext()) {
int index = attachments.indexOf(it.next());
attachments.set(index, null);
}
- FinalArrayList f = new FinalArrayList();
+ 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,11 +1064,11 @@
SOAPPartImpl sp = (SOAPPartImpl) getSOAPPart();
return sp.getContentAsStream();
}
private String convertToSingleLine(String contentType) {
- StringBuffer buffer = new StringBuffer();
+ 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,11 +1096,11 @@
if (!switchOffBM && !switchOffLazyAttachment &&
(multiPart != null) && !attachmentsInitialized) {
headerAndBody = new BMMimeMultipart();
headerAndBody.addBodyPart(mimeSoapPart);
if (attachments != null) {
- for (Iterator eachAttachment = attachments.iterator();
+ for (Iterator<AttachmentPart> eachAttachment = attachments.iterator();
eachAttachment.hasNext();) {
headerAndBody.addBodyPart(
((AttachmentPartImpl) eachAttachment.next())
.getMimePart());
}
@@ -1422,11 +1422,11 @@
if (attachmentsInitialized || (multiPart == null)) {
return;
}
if (attachments == null)
- attachments = new FinalArrayList();
+ attachments = new FinalArrayList<AttachmentPart>();
int count = multiPart.getCount();
for (int i=0; i < count; i++ ) {
initializeAttachment(multiPart.getBodyPart(i));
}
< prev index next >