mirror of
https://github.com/moparisthebest/davmail
synced 2024-08-13 16:53:51 -04:00
IMAP: improve bodystructure error handling
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1978 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
f9fb4307d9
commit
ab536ded32
@ -48,8 +48,7 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dav Gateway smtp connection implementation.
|
* Dav Gateway IMAP connection implementation.
|
||||||
* Still alpha code : need to find a way to handle message ids
|
|
||||||
*/
|
*/
|
||||||
public class ImapConnection extends AbstractConnection {
|
public class ImapConnection extends AbstractConnection {
|
||||||
private static final Logger LOGGER = Logger.getLogger(ImapConnection.class);
|
private static final Logger LOGGER = Logger.getLogger(ImapConnection.class);
|
||||||
@ -1068,6 +1067,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
|
|
||||||
for (int i = 0; i < multiPart.getCount(); i++) {
|
for (int i = 0; i < multiPart.getCount(); i++) {
|
||||||
MimeBodyPart bodyPart = (MimeBodyPart) multiPart.getBodyPart(i);
|
MimeBodyPart bodyPart = (MimeBodyPart) multiPart.getBodyPart(i);
|
||||||
|
try {
|
||||||
Object mimeBody = bodyPart.getContent();
|
Object mimeBody = bodyPart.getContent();
|
||||||
if (mimeBody instanceof MimeMultipart) {
|
if (mimeBody instanceof MimeMultipart) {
|
||||||
appendBodyStructure(buffer, (MimeMultipart) mimeBody);
|
appendBodyStructure(buffer, (MimeMultipart) mimeBody);
|
||||||
@ -1075,6 +1075,15 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
// no multipart, single body
|
// no multipart, single body
|
||||||
appendBodyStructure(buffer, bodyPart);
|
appendBodyStructure(buffer, bodyPart);
|
||||||
}
|
}
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
LOGGER.warn(e);
|
||||||
|
// failover: send default bodystructure
|
||||||
|
buffer.append("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"US-ASCII\") NIL NIL NIL NIL NIL)");
|
||||||
|
} catch (MessagingException me) {
|
||||||
|
DavGatewayTray.warn(me);
|
||||||
|
// failover: send default bodystructure
|
||||||
|
buffer.append("(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"US-ASCII\") NIL NIL NIL NIL NIL)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int slashIndex = multiPart.getContentType().indexOf('/');
|
int slashIndex = multiPart.getContentType().indexOf('/');
|
||||||
if (slashIndex < 0) {
|
if (slashIndex < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user