1
0
mirror of https://github.com/etesync/android synced 2025-06-08 09:08:48 +00:00

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

This commit is contained in:
rfc2822 2013-10-30 15:14:19 +01:00
parent b6611131db
commit dbc89cb4fe
5 changed files with 10 additions and 6 deletions

View File

@ -133,7 +133,8 @@ public class Contact extends Resource {
if (vcard == null) if (vcard == null)
return; return;
} catch(Exception ex) { } 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); Uid uid = (Uid)vcard.getProperty(Id.UID);

View File

@ -83,7 +83,7 @@ public abstract class RemoteCollection<ResourceType extends Resource> {
resource.parseEntity(member.getContent()); resource.parseEntity(member.getContent());
foundResources.add(resource); foundResources.add(resource);
} catch (ParserException ex) { } 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]); return foundResources.toArray(new Resource[0]);

View File

@ -103,7 +103,6 @@ public class EnterCredentialsFragment extends Fragment implements TextWatcher {
FragmentTransaction ft = getFragmentManager().beginTransaction(); FragmentTransaction ft = getFragmentManager().beginTransaction();
String host_path = editBaseURL.getText().toString(); String host_path = editBaseURL.getText().toString();
if (!host_path.endsWith("/")) host_path = host_path + "/";
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString(QueryServerDialogFragment.EXTRA_BASE_URL, protocol + host_path); args.putString(QueryServerDialogFragment.EXTRA_BASE_URL, protocol + host_path);

View File

@ -43,8 +43,8 @@ public class WebDavCollection extends WebDavResource {
@Getter protected List<WebDavResource> members = new LinkedList<WebDavResource>(); @Getter protected List<WebDavResource> members = new LinkedList<WebDavResource>();
public WebDavCollection(URI baseURL, String username, String password, boolean preemptiveAuth) { public WebDavCollection(URI baseURL, String username, String password, boolean preemptiveAuth) throws URISyntaxException {
super(baseURL, username, password, preemptiveAuth); super(baseURL, username, password, preemptiveAuth, true);
} }
public WebDavCollection(WebDavCollection parent, URI member) { public WebDavCollection(WebDavCollection parent, URI member) {

View File

@ -10,6 +10,7 @@ package at.bitfire.davdroid.webdav;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -64,9 +65,12 @@ public class WebDavResource {
protected DefaultHttpClient client; 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(); location = baseURL.normalize();
if (isCollection && !location.getPath().endsWith("/"))
location = new URI(location.getScheme(), location.getSchemeSpecificPart() + "/", null);
client = new DefaultHttpClient(); client = new DefaultHttpClient();
client.getCredentialsProvider().setCredentials(new AuthScope(location.getHost(), location.getPort()), client.getCredentialsProvider().setCredentials(new AuthScope(location.getHost(), location.getPort()),
new UsernamePasswordCredentials(username, password)); new UsernamePasswordCredentials(username, password));