mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
API 7 fixes
This commit is contained in:
parent
976761e0e5
commit
98d0b61890
@ -422,13 +422,13 @@ public class MimeMessage extends Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MimeMessageBuilder implements ContentHandler {
|
class MimeMessageBuilder implements ContentHandler {
|
||||||
private final Deque<Object> stack = new ArrayDeque<Object>();
|
private final LinkedList<Object> stack = new LinkedList<Object>();
|
||||||
|
|
||||||
public MimeMessageBuilder() {
|
public MimeMessageBuilder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void expect(Class<?> c) {
|
private void expect(Class<?> c) {
|
||||||
if (!c.isInstance(stack.peekFirst())) {
|
if (!c.isInstance(stack.peek())) {
|
||||||
throw new IllegalStateException("Internal stack error: " + "Expected '"
|
throw new IllegalStateException("Internal stack error: " + "Expected '"
|
||||||
+ c.getName() + "' found '" + stack.peek().getClass().getName() + "'");
|
+ c.getName() + "' found '" + stack.peek().getClass().getName() + "'");
|
||||||
}
|
}
|
||||||
@ -441,7 +441,7 @@ public class MimeMessage extends Message {
|
|||||||
expect(Part.class);
|
expect(Part.class);
|
||||||
try {
|
try {
|
||||||
MimeMessage m = new MimeMessage();
|
MimeMessage m = new MimeMessage();
|
||||||
((Part)stack.peekFirst()).setBody(m);
|
((Part)stack.peek()).setBody(m);
|
||||||
stack.addFirst(m);
|
stack.addFirst(m);
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
throw new Error(me);
|
throw new Error(me);
|
||||||
@ -462,7 +462,7 @@ public class MimeMessage extends Message {
|
|||||||
expect(Part.class);
|
expect(Part.class);
|
||||||
try {
|
try {
|
||||||
Field parsedField = DefaultFieldParser.parse(field.getRaw(), null);
|
Field parsedField = DefaultFieldParser.parse(field.getRaw(), null);
|
||||||
((Part)stack.peekFirst()).addHeader(parsedField.getName(), parsedField.getBody().trim());
|
((Part)stack.peek()).addHeader(parsedField.getName(), parsedField.getBody().trim());
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
throw new Error(me);
|
throw new Error(me);
|
||||||
} catch (MimeException me) {
|
} catch (MimeException me) {
|
||||||
@ -474,7 +474,7 @@ public class MimeMessage extends Message {
|
|||||||
expect(Part.class);
|
expect(Part.class);
|
||||||
try {
|
try {
|
||||||
String[] tokens = fieldData.split(":", 2);
|
String[] tokens = fieldData.split(":", 2);
|
||||||
((Part)stack.peekFirst()).addHeader(tokens[0], tokens[1].trim());
|
((Part)stack.peek()).addHeader(tokens[0], tokens[1].trim());
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
throw new Error(me);
|
throw new Error(me);
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ public class MimeMessage extends Message {
|
|||||||
public void startMultipart(BodyDescriptor bd) {
|
public void startMultipart(BodyDescriptor bd) {
|
||||||
expect(Part.class);
|
expect(Part.class);
|
||||||
|
|
||||||
Part e = (Part)stack.peekFirst();
|
Part e = (Part)stack.peek();
|
||||||
try {
|
try {
|
||||||
MimeMultipart multiPart = new MimeMultipart(e.getContentType());
|
MimeMultipart multiPart = new MimeMultipart(e.getContentType());
|
||||||
e.setBody(multiPart);
|
e.setBody(multiPart);
|
||||||
@ -501,7 +501,7 @@ public class MimeMessage extends Message {
|
|||||||
expect(Part.class);
|
expect(Part.class);
|
||||||
Body body = MimeUtility.decodeBody(in, bd.getTransferEncoding());
|
Body body = MimeUtility.decodeBody(in, bd.getTransferEncoding());
|
||||||
try {
|
try {
|
||||||
((Part)stack.peekFirst()).setBody(body);
|
((Part)stack.peek()).setBody(body);
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
throw new Error(me);
|
throw new Error(me);
|
||||||
}
|
}
|
||||||
@ -516,7 +516,7 @@ public class MimeMessage extends Message {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
MimeBodyPart bodyPart = new MimeBodyPart();
|
MimeBodyPart bodyPart = new MimeBodyPart();
|
||||||
((MimeMultipart)stack.peekFirst()).addBodyPart(bodyPart);
|
((MimeMultipart)stack.peek()).addBodyPart(bodyPart);
|
||||||
stack.addFirst(bodyPart);
|
stack.addFirst(bodyPart);
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
throw new Error(me);
|
throw new Error(me);
|
||||||
@ -535,7 +535,7 @@ public class MimeMessage extends Message {
|
|||||||
while ((b = is.read()) != -1) {
|
while ((b = is.read()) != -1) {
|
||||||
sb.append((char)b);
|
sb.append((char)b);
|
||||||
}
|
}
|
||||||
// ((Multipart) stack.peekFirst()).setEpilogue(sb.toString());
|
// ((Multipart) stack.peek()).setEpilogue(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preamble(InputStream is) throws IOException {
|
public void preamble(InputStream is) throws IOException {
|
||||||
@ -545,7 +545,7 @@ public class MimeMessage extends Message {
|
|||||||
while ((b = is.read()) != -1) {
|
while ((b = is.read()) != -1) {
|
||||||
sb.append((char)b);
|
sb.append((char)b);
|
||||||
}
|
}
|
||||||
((MimeMultipart)stack.peekFirst()).setPreamble(sb.toString());
|
((MimeMultipart)stack.peek()).setPreamble(sb.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1942,7 +1942,7 @@ public class WebDavStore extends Store {
|
|||||||
*/
|
*/
|
||||||
public class WebDavHandler extends DefaultHandler {
|
public class WebDavHandler extends DefaultHandler {
|
||||||
private DataSet mDataSet = new DataSet();
|
private DataSet mDataSet = new DataSet();
|
||||||
private final Deque<String> mOpenTags = new ArrayDeque<String>();
|
private final LinkedList<String> mOpenTags = new LinkedList<String>();
|
||||||
|
|
||||||
public DataSet getDataSet() {
|
public DataSet getDataSet() {
|
||||||
return this.mDataSet;
|
return this.mDataSet;
|
||||||
@ -1977,7 +1977,7 @@ public class WebDavStore extends Store {
|
|||||||
@Override
|
@Override
|
||||||
public void characters(char ch[], int start, int length) {
|
public void characters(char ch[], int start, int length) {
|
||||||
String value = new String(ch, start, length);
|
String value = new String(ch, start, length);
|
||||||
mDataSet.addValue(value, mOpenTags.peekFirst());
|
mDataSet.addValue(value, mOpenTags.peek());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user