mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
Caldav: skip empty lines
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1327 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
1488b2dd1e
commit
76ced7915b
@ -86,12 +86,15 @@ public class VObject {
|
||||
|
||||
|
||||
protected void handleLine(String line, BufferedReader reader) throws IOException {
|
||||
VProperty property = new VProperty(line);
|
||||
// inner object
|
||||
if ("BEGIN".equals(property.getKey())) {
|
||||
addVObject(new VObject(property, reader));
|
||||
} else {
|
||||
addProperty(property);
|
||||
// skip empty lines
|
||||
if (line.length() > 0) {
|
||||
VProperty property = new VProperty(line);
|
||||
// inner object
|
||||
if ("BEGIN".equals(property.getKey())) {
|
||||
addVObject(new VObject(property, reader));
|
||||
} else if (property.getKey() != null) {
|
||||
addProperty(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,7 +154,7 @@ public class VObject {
|
||||
public VProperty getProperty(String name) {
|
||||
if (properties != null) {
|
||||
for (VProperty property : properties) {
|
||||
if (property.getKey().equalsIgnoreCase(name)) {
|
||||
if (property.getKey() != null && property.getKey().equalsIgnoreCase(name)) {
|
||||
return property;
|
||||
}
|
||||
}
|
||||
@ -164,7 +167,7 @@ public class VObject {
|
||||
List<VProperty> result = null;
|
||||
if (properties != null) {
|
||||
for (VProperty property : properties) {
|
||||
if (property.getKey().equalsIgnoreCase(name)) {
|
||||
if (property.getKey() != null && property.getKey().equalsIgnoreCase(name)) {
|
||||
if (result == null) {
|
||||
result = new ArrayList<VProperty>();
|
||||
}
|
||||
|
@ -251,4 +251,15 @@ public class TestExchangeSessionEvent extends TestCase {
|
||||
assertTrue(toClient.contains("EXDATE;TZID=\"Europe/Paris\":20100823T150000"));
|
||||
|
||||
}
|
||||
|
||||
public void testEmptyLine() throws IOException {
|
||||
String itemBody = "BEGIN:VCALENDAR\n" +
|
||||
"BEGIN:VEVENT\n" +
|
||||
"\n" +
|
||||
"END:VEVENT\n" +
|
||||
"END:VCALENDAR";
|
||||
String toClient = fixICS(itemBody, true);
|
||||
System.out.println(toClient);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user