diff --git a/src/at/bitfire/davdroid/resource/Contact.java b/src/at/bitfire/davdroid/resource/Contact.java index 86bb48b0..9a6c7000 100644 --- a/src/at/bitfire/davdroid/resource/Contact.java +++ b/src/at/bitfire/davdroid/resource/Contact.java @@ -133,7 +133,8 @@ public class Contact extends Resource { if (vcard == null) return; } catch(Exception ex) { - throw new ParserException("VCard parser crashed", -1); + Log.e(TAG, "VCard parser exception", ex); + throw new ParserException("VCard parser crashed", -1, ex); } Uid uid = (Uid)vcard.getProperty(Id.UID); diff --git a/src/at/bitfire/davdroid/resource/RemoteCollection.java b/src/at/bitfire/davdroid/resource/RemoteCollection.java index 1ff29731..5e5557ea 100644 --- a/src/at/bitfire/davdroid/resource/RemoteCollection.java +++ b/src/at/bitfire/davdroid/resource/RemoteCollection.java @@ -83,7 +83,7 @@ public abstract class RemoteCollection { resource.parseEntity(member.getContent()); foundResources.add(resource); } catch (ParserException ex) { - Log.e(TAG, "Ignoring unparseable entity in multi-response: " + ex.toString(), ex); + Log.e(TAG, "Ignoring unparseable entity in multi-response", ex); } } return foundResources.toArray(new Resource[0]); diff --git a/src/at/bitfire/davdroid/syncadapter/EnterCredentialsFragment.java b/src/at/bitfire/davdroid/syncadapter/EnterCredentialsFragment.java index ff00d205..d5c26c37 100644 --- a/src/at/bitfire/davdroid/syncadapter/EnterCredentialsFragment.java +++ b/src/at/bitfire/davdroid/syncadapter/EnterCredentialsFragment.java @@ -103,7 +103,6 @@ public class EnterCredentialsFragment extends Fragment implements TextWatcher { FragmentTransaction ft = getFragmentManager().beginTransaction(); String host_path = editBaseURL.getText().toString(); - if (!host_path.endsWith("/")) host_path = host_path + "/"; Bundle args = new Bundle(); args.putString(QueryServerDialogFragment.EXTRA_BASE_URL, protocol + host_path); diff --git a/src/at/bitfire/davdroid/webdav/WebDavCollection.java b/src/at/bitfire/davdroid/webdav/WebDavCollection.java index 07101a19..4b227787 100644 --- a/src/at/bitfire/davdroid/webdav/WebDavCollection.java +++ b/src/at/bitfire/davdroid/webdav/WebDavCollection.java @@ -43,8 +43,8 @@ public class WebDavCollection extends WebDavResource { @Getter protected List members = new LinkedList(); - public WebDavCollection(URI baseURL, String username, String password, boolean preemptiveAuth) { - super(baseURL, username, password, preemptiveAuth); + public WebDavCollection(URI baseURL, String username, String password, boolean preemptiveAuth) throws URISyntaxException { + super(baseURL, username, password, preemptiveAuth, true); } public WebDavCollection(WebDavCollection parent, URI member) { diff --git a/src/at/bitfire/davdroid/webdav/WebDavResource.java b/src/at/bitfire/davdroid/webdav/WebDavResource.java index 6c3eae3b..1c1115ed 100644 --- a/src/at/bitfire/davdroid/webdav/WebDavResource.java +++ b/src/at/bitfire/davdroid/webdav/WebDavResource.java @@ -10,6 +10,7 @@ package at.bitfire.davdroid.webdav; import java.io.IOException; import java.io.InputStream; import java.net.URI; +import java.net.URISyntaxException; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; @@ -64,9 +65,12 @@ public class WebDavResource { protected DefaultHttpClient client; - public WebDavResource(URI baseURL, String username, String password, boolean preemptive) { + public WebDavResource(URI baseURL, String username, String password, boolean preemptive, boolean isCollection) throws URISyntaxException { location = baseURL.normalize(); + if (isCollection && !location.getPath().endsWith("/")) + location = new URI(location.getScheme(), location.getSchemeSpecificPart() + "/", null); + client = new DefaultHttpClient(); client.getCredentialsProvider().setCredentials(new AuthScope(location.getHost(), location.getPort()), new UsernamePasswordCredentials(username, password));