EWS: improve failover on error retrieving MimeContent

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1897 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2012-02-06 08:34:46 +00:00
parent 4c00d1da2d
commit 443a3df55b
1 changed files with 7 additions and 2 deletions

View File

@ -503,9 +503,14 @@ public class EwsExchangeSession extends ExchangeSession {
protected byte[] getContent(ItemId itemId) throws IOException {
GetItemMethod getItemMethod = new GetItemMethod(BaseShape.ID_ONLY, itemId, true);
executeMethod(getItemMethod);
byte[] mimeContent = getItemMethod.getMimeContent();
byte[] mimeContent = null;
try {
mimeContent = getItemMethod.getMimeContent();
} catch (EWSException e) {
LOGGER.warn("GetItem with MimeContent failed: "+e.getMessage());
}
if (mimeContent == null) {
LOGGER.warn("GetItem returned null MimeContent, trying to rebuild from properties");
LOGGER.warn("MimeContent not available, trying to rebuild from properties");
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
getItemMethod = new GetItemMethod(BaseShape.ID_ONLY, itemId, false);