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:
parent
b6611131db
commit
dbc89cb4fe
@ -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);
|
||||||
|
@ -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]);
|
||||||
|
@ -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);
|
||||||
|
@ -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) {
|
||||||
|
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user