Resilience against multi-status with <propstat> without <status> + test

parent 94b582dd
......@@ -2,14 +2,11 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "0.1-beta"
}
buildTypes {
release {
......
......@@ -35,7 +35,7 @@ public class DavResourceTest extends TestCase {
@Override
public void setUp() throws IOException {
mockServer.start(2540);
mockServer.start();
}
@Override
......@@ -469,7 +469,24 @@ public class DavResourceTest extends TestCase {
"</multistatus>"));
dav.propfind(0, ResourceType.NAME, DisplayName.NAME);
assertTrue(((ResourceType) dav.properties.get(ResourceType.NAME)).types.contains(ResourceType.COLLECTION));
assertEquals("My DAV Collection", ((DisplayName)dav.properties.get(DisplayName.NAME)).displayName);
assertEquals("My DAV Collection", ((DisplayName) dav.properties.get(DisplayName.NAME)).displayName);
// multi-status response with <propstat> that doesn't contain <status> (=> assume 200 OK)
mockServer.enqueue(new MockResponse()
.setResponseCode(207)
.setHeader("Content-Type", "application/xml; charset=utf-8")
.setBody("<multistatus xmlns='DAV:'>" +
" <response>" +
" <href>/dav</href>" +
" <propstat>" +
" <prop>" +
" <displayname>Without Status</displayname>" +
" </prop>" +
" </propstat>" +
" </response>" +
"</multistatus>"));
dav.propfind(0, DisplayName.NAME);
assertEquals("Without Status", ((DisplayName) dav.properties.get(DisplayName.NAME)).displayName);
}
public void testPropfindUpdateProperties() throws IOException, HttpException, DavException {
......
......@@ -505,7 +505,7 @@ public class DavResource {
eventType = parser.next();
}
if (status.code/100 != 2)
if (status != null && status.code/100 != 2)
// not successful, null out property values so that they can be removed when merging in parseMultiStatus_Response
prop.nullAllValues();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment