diff --git a/src/com/fsck/k9/mail/Multipart.java b/src/com/fsck/k9/mail/Multipart.java index 7e397f51f..88651485a 100644 --- a/src/com/fsck/k9/mail/Multipart.java +++ b/src/com/fsck/k9/mail/Multipart.java @@ -13,7 +13,7 @@ import com.fsck.k9.mail.internet.TextBody; public abstract class Multipart implements CompositeBody { private Part mParent; - protected ArrayList mParts = new ArrayList(); + private final ArrayList mParts = new ArrayList(); private String mContentType; diff --git a/src/com/fsck/k9/mail/internet/MimeMultipart.java b/src/com/fsck/k9/mail/internet/MimeMultipart.java index a63ebad04..124ca5e4c 100644 --- a/src/com/fsck/k9/mail/internet/MimeMultipart.java +++ b/src/com/fsck/k9/mail/internet/MimeMultipart.java @@ -71,20 +71,19 @@ public class MimeMultipart extends Multipart { writer.write("\r\n"); } - if (mParts.isEmpty()) { + if (getBodyParts().isEmpty()) { writer.write("--"); writer.write(mBoundary); writer.write("\r\n"); - } - - for (int i = 0, count = mParts.size(); i < count; i++) { - BodyPart bodyPart = mParts.get(i); - writer.write("--"); - writer.write(mBoundary); - writer.write("\r\n"); - writer.flush(); - bodyPart.writeTo(out); - writer.write("\r\n"); + } else { + for (BodyPart bodyPart : getBodyParts()) { + writer.write("--"); + writer.write(mBoundary); + writer.write("\r\n"); + writer.flush(); + bodyPart.writeTo(out); + writer.write("\r\n"); + } } writer.write("--"); @@ -100,7 +99,7 @@ public class MimeMultipart extends Multipart { @Override public void setUsing7bitTransport() throws MessagingException { - for (BodyPart part : mParts) { + for (BodyPart part : getBodyParts()) { part.setUsing7bitTransport(); } }