1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 03:02:22 -05:00

Caldav: fix regression in REPORT requests parsing

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1276 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-26 09:28:44 +00:00
parent 172c167300
commit a7de241e14
2 changed files with 22 additions and 23 deletions

View File

@ -1380,39 +1380,29 @@ public class CaldavConnection extends AbstractConnection {
streamReader = inputFactory.createXMLStreamReader(new StringReader(body));
boolean inElement = false;
boolean inProperties = false;
String currentElement = null;
String tagLocalName = null;
while (streamReader.hasNext()) {
int event = streamReader.next();
if (event == XMLStreamConstants.START_ELEMENT) {
inElement = true;
currentElement = streamReader.getLocalName();
if ("prop".equals(currentElement)) {
inProperties = true;
} else if ("calendar-multiget".equals(currentElement)
|| "addressbook-multiget".equals(currentElement)) {
tagLocalName = streamReader.getLocalName();
if ("prop".equals(tagLocalName)) {
handleProp(streamReader);
} else if ("calendar-multiget".equals(tagLocalName)
|| "addressbook-multiget".equals(tagLocalName)) {
isMultiGet = true;
} else if ("comp-filter".equals(currentElement)) {
} else if ("comp-filter".equals(tagLocalName)) {
handleCompFilter(streamReader);
} else if (inProperties && !"calendar-free-busy-set".equals(currentElement)) {
properties.put(currentElement, streamReader.getElementText());
}
} else if (event == XMLStreamConstants.END_ELEMENT) {
if ("prop".equals(currentElement)) {
inProperties = false;
}
} else if (event == XMLStreamConstants.CHARACTERS && inElement) {
if ("href".equals(currentElement)) {
} else if ("href".equals(tagLocalName)) {
if (hrefs == null) {
hrefs = new HashSet<String>();
}
if (isBrokenHrefEncoding()) {
hrefs.add(streamReader.getText());
hrefs.add(streamReader.getElementText());
} else {
hrefs.add(URIUtil.decode(encodePlusSign(streamReader.getText())));
hrefs.add(URIUtil.decode(encodePlusSign(streamReader.getElementText())));
}
}
inElement = false;
}
}
} catch (XMLStreamException e) {
@ -1445,6 +1435,18 @@ public class CaldavConnection extends AbstractConnection {
}
}
public void handleProp(XMLStreamReader reader) throws XMLStreamException {
while (reader.hasNext() && !isEndTag(reader, "prop")) {
int event = reader.next();
if (event == XMLStreamConstants.START_ELEMENT) {
String tagLocalName = reader.getLocalName();
if (!"calendar-free-busy-set".equals(tagLocalName)) {
properties.put(tagLocalName, reader.getElementText());
}
}
}
}
public boolean hasProperty(String propertyName) {
return properties.containsKey(propertyName);
}

View File

@ -459,7 +459,4 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
assertEquals("common name", contact.get("cn"));
}
public void testdqdsq() throws IOException {
session.searchContacts("testcontactfolder", ExchangeSession.CONTACT_ATTRIBUTES, null);
}
}