From 621f87fcbcd4f4262fa7f9f5b6e0e259c75d74b2 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 27 Nov 2010 04:03:15 +0000 Subject: [PATCH] Revert "refactor getHeaders and removeHeaders to use a common method and an" Subtly flawed. Returned the wrong headers This reverts commit 657b3961f86b1b694fb7587216ecefeb0b20f5d2. --- src/com/fsck/k9/mail/internet/MimeHeader.java | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/com/fsck/k9/mail/internet/MimeHeader.java b/src/com/fsck/k9/mail/internet/MimeHeader.java index 6a2672a93..1b260cf9f 100644 --- a/src/com/fsck/k9/mail/internet/MimeHeader.java +++ b/src/com/fsck/k9/mail/internet/MimeHeader.java @@ -83,7 +83,14 @@ public class MimeHeader public String[] getHeader(String name) { - ArrayList values = findHeaders(name); + ArrayList values = new ArrayList(); + for (Field field : mFields) + { + if (field.name.equalsIgnoreCase(name)) + { + values.add(field.value); + } + } if (values.size() == 0) { return null; @@ -93,27 +100,17 @@ public class MimeHeader public void removeHeader(String name) { - - ArrayList removeFields = findHeaders(name); + ArrayList removeFields = new ArrayList(); + for (Field field : mFields) + { + if (field.name.equalsIgnoreCase(name)) + { + removeFields.add(field); + } + } mFields.removeAll(removeFields); } - private ArrayList findHeaders(String name) { - ArrayList values = new ArrayList(); - Iterator iter = mFields.iterator(); - while (iter.hasNext()) - { - Field field = iter.next(); - if (field.name.equalsIgnoreCase(name) ) - { - values.add(field.value); - } - } - - return values; - } - - public void writeTo(OutputStream out) throws IOException, MessagingException { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);