1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-11-12 04:15:08 -05:00

Caldav: fix regression in getAllDayLine()

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1006 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-04-15 12:56:55 +00:00
parent dc4b7cc77e
commit 7778e4ea69

View File

@ -1698,7 +1698,7 @@ public class ExchangeSession {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
write(baos, false); write(baos, false);
mimeMessage = new MimeMessage(null, new ByteArrayInputStream(baos.toByteArray())); mimeMessage = new MimeMessage(null, new ByteArrayInputStream(baos.toByteArray()));
LOGGER.debug("Dowloaded message content for "+imapUid+" ("+baos.size()+")"); LOGGER.debug("Downloaded message content for "+imapUid+" ("+baos.size()+ ')');
} }
} }
return mimeMessage; return mimeMessage;
@ -1858,7 +1858,7 @@ public class ExchangeSession {
result = fixICS(new String(baos.toByteArray(), "UTF-8"), true); result = fixICS(new String(baos.toByteArray(), "UTF-8"), true);
} else { } else {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
mimeMessage.getDataHandler().writeTo(baos); mimeMessage.writeTo(baos);
baos.close(); baos.close();
throw new DavMailException("EXCEPTION_INVALID_MESSAGE_CONTENT", new String(baos.toByteArray(), "UTF-8")); throw new DavMailException("EXCEPTION_INVALID_MESSAGE_CONTENT", new String(baos.toByteArray(), "UTF-8"));
} }
@ -1971,12 +1971,15 @@ public class ExchangeSession {
} }
protected String getAllDayLine(String line) throws IOException { protected String getAllDayLine(String line) throws IOException {
int keyIndex = line.indexOf(';');
int valueIndex = line.lastIndexOf(':'); int valueIndex = line.lastIndexOf(':');
int valueEndIndex = line.lastIndexOf('T'); int valueEndIndex = line.lastIndexOf('T');
if (valueIndex < 0 || valueEndIndex < 0) { if (valueIndex < 0 || valueEndIndex < 0) {
throw new DavMailException("EXCEPTION_INVALID_ICS_LINE", line); throw new DavMailException("EXCEPTION_INVALID_ICS_LINE", line);
} }
int keyIndex = line.indexOf(';');
if (keyIndex == -1) {
keyIndex = valueIndex;
}
String dateValue = line.substring(valueIndex + 1, valueEndIndex); String dateValue = line.substring(valueIndex + 1, valueEndIndex);
String key = line.substring(0, Math.min(keyIndex, valueIndex)); String key = line.substring(0, Math.min(keyIndex, valueIndex));
return key + ";VALUE=DATE:" + dateValue; return key + ";VALUE=DATE:" + dateValue;