mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
IMAP: detect and ignore missing message to avoid NullPointerException
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1982 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
b4498179b1
commit
939115a471
@ -704,6 +704,8 @@ public abstract class EWSMethod extends PostMethod {
|
||||
public int getStatusCode() {
|
||||
if ("ErrorAccessDenied".equals(errorDetail)) {
|
||||
return HttpStatus.SC_FORBIDDEN;
|
||||
} else if ("ErrorItemNotFound".equals(errorDetail)) {
|
||||
return HttpStatus.SC_NOT_FOUND;
|
||||
} else {
|
||||
return super.getStatusCode();
|
||||
}
|
||||
|
@ -540,6 +540,9 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
} catch (EWSException e) {
|
||||
LOGGER.warn("GetItem with MimeContent failed: " + e.getMessage());
|
||||
}
|
||||
if (getItemMethod.getStatusCode() == HttpStatus.SC_NOT_FOUND) {
|
||||
throw new HttpNotFoundException("Item "+itemId+" not found");
|
||||
}
|
||||
if (mimeContent == null) {
|
||||
LOGGER.warn("MimeContent not available, trying to rebuild from properties");
|
||||
try {
|
||||
|
@ -299,6 +299,8 @@ public class ImapConnection extends AbstractConnection {
|
||||
ExchangeSession.Message message = uidRangeIterator.next();
|
||||
try {
|
||||
handleFetch(message, uidRangeIterator.currentIndex, parameters);
|
||||
} catch (HttpNotFoundException e) {
|
||||
LOGGER.warn("Ignore missing message "+uidRangeIterator.currentIndex);
|
||||
} catch (SocketException e) {
|
||||
// client closed connection
|
||||
throw e;
|
||||
@ -383,6 +385,8 @@ public class ImapConnection extends AbstractConnection {
|
||||
ExchangeSession.Message message = rangeIterator.next();
|
||||
try {
|
||||
handleFetch(message, rangeIterator.currentIndex, parameters);
|
||||
} catch (HttpNotFoundException e) {
|
||||
LOGGER.warn("Ignore missing message "+rangeIterator.currentIndex);
|
||||
} catch (SocketException e) {
|
||||
// client closed connection, rethrow exception
|
||||
throw e;
|
||||
|
Loading…
x
Reference in New Issue
Block a user