better vcard parsing error logging, always append trailing slash to collection URLs

pull/2/head
rfc2822 11 years ago
parent b6611131db
commit dbc89cb4fe

@ -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);

@ -83,7 +83,7 @@ public abstract class RemoteCollection<ResourceType extends Resource> {
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]);

@ -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);

@ -43,8 +43,8 @@ public class WebDavCollection extends WebDavResource {
@Getter protected List<WebDavResource> members = new LinkedList<WebDavResource>();
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) {

@ -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));

Loading…
Cancel
Save