mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-26 01:28:50 -05:00
Revert "refactor getHeaders and removeHeaders to use a common method and an"
Subtly flawed. Returned the wrong headers This reverts commit 657b3961f86b1b694fb7587216ecefeb0b20f5d2.
This commit is contained in:
parent
75108f4078
commit
621f87fcbc
@ -83,7 +83,14 @@ public class MimeHeader
|
|||||||
|
|
||||||
public String[] getHeader(String name)
|
public String[] getHeader(String name)
|
||||||
{
|
{
|
||||||
ArrayList<String> values = findHeaders(name);
|
ArrayList<String> values = new ArrayList<String>();
|
||||||
|
for (Field field : mFields)
|
||||||
|
{
|
||||||
|
if (field.name.equalsIgnoreCase(name))
|
||||||
|
{
|
||||||
|
values.add(field.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (values.size() == 0)
|
if (values.size() == 0)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -93,27 +100,17 @@ public class MimeHeader
|
|||||||
|
|
||||||
public void removeHeader(String name)
|
public void removeHeader(String name)
|
||||||
{
|
{
|
||||||
|
ArrayList<Field> removeFields = new ArrayList<Field>();
|
||||||
ArrayList<String> removeFields = findHeaders(name);
|
for (Field field : mFields)
|
||||||
mFields.removeAll(removeFields);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList findHeaders(String name) {
|
|
||||||
ArrayList<String> values = new ArrayList<String>();
|
|
||||||
Iterator<Field> iter = mFields.iterator();
|
|
||||||
while (iter.hasNext())
|
|
||||||
{
|
{
|
||||||
Field field = iter.next();
|
|
||||||
if (field.name.equalsIgnoreCase(name))
|
if (field.name.equalsIgnoreCase(name))
|
||||||
{
|
{
|
||||||
values.add(field.value);
|
removeFields.add(field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mFields.removeAll(removeFields);
|
||||||
return values;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void writeTo(OutputStream out) throws IOException, MessagingException
|
public void writeTo(OutputStream out) throws IOException, MessagingException
|
||||||
{
|
{
|
||||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
|
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
|
||||||
|
Loading…
Reference in New Issue
Block a user