diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index 13734c15..d58ae199 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -507,17 +507,19 @@ public class ExchangeSession { } // add bcc and other properties - patchMethod = new PropPatchMethod(messageUrl); - try { - // update message with blind carbon copy and other flags - addProperties(patchMethod, properties); - int statusCode = wdr.retrieveSessionInstance().executeMethod(patchMethod); - if (statusCode != HttpStatus.SC_MULTI_STATUS) { - throw new IOException("Unable to patch message " + messageUrl + ": " + statusCode + " " + patchMethod.getStatusLine()); - } + if (properties.size() > 0) { + patchMethod = new PropPatchMethod(messageUrl); + try { + // update message with blind carbon copy and other flags + addProperties(patchMethod, properties); + int statusCode = wdr.retrieveSessionInstance().executeMethod(patchMethod); + if (statusCode != HttpStatus.SC_MULTI_STATUS) { + throw new IOException("Unable to patch message " + messageUrl + ": " + statusCode + " " + patchMethod.getStatusLine()); + } - } finally { - patchMethod.releaseConnection(); + } finally { + patchMethod.releaseConnection(); + } } } diff --git a/src/java/davmail/imap/ImapConnection.java b/src/java/davmail/imap/ImapConnection.java index 80455c60..5b7e6903 100644 --- a/src/java/davmail/imap/ImapConnection.java +++ b/src/java/davmail/imap/ImapConnection.java @@ -41,6 +41,7 @@ public class ImapConnection extends AbstractConnection { String commandId = null; StringTokenizer tokens; try { + ExchangeSessionFactory.checkConfig(); sendClient("* OK [CAPABILITY IMAP4REV1 AUTH=LOGIN] IMAP4rev1 DavMail server ready"); for (; ;) { line = readClient(); @@ -368,6 +369,7 @@ public class ImapConnection extends AbstractConnection { } } // skip optional date + // TODO : replace datereceived String dateOrSize = tokens.nextToken(); if (tokens.hasMoreTokens()) { dateOrSize = tokens.nextToken(); @@ -428,7 +430,7 @@ public class ImapConnection extends AbstractConnection { if (commandId != null) { sendClient(commandId + " BAD unable to handle request: " + e.getMessage()); } else { - sendClient("* BAD unable to handle request: " + e.getMessage()); + sendClient("* BYE unable to handle request: " + e.getMessage()); } } catch (IOException e2) { DavGatewayTray.warn("Exception sending error to client", e2);