mirror of
https://github.com/etesync/android
synced 2024-11-26 01:48:34 +00:00
Bug fixes
* ignore non-OK values in multi-status response (fixes #35) * fixes wrong entries in setup calendar/addressbook selection
This commit is contained in:
parent
03a85da6e3
commit
42929ddcf1
@ -84,8 +84,8 @@ public class SelectCollectionsAdapter extends BaseAdapter implements ListAdapter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
if (convertView != null)
|
/*if (convertView != null)
|
||||||
return convertView;
|
return convertView;*/
|
||||||
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||||
|
|
||||||
|
@ -52,8 +52,6 @@ public class SelectCollectionsFragment extends ListFragment {
|
|||||||
final ListView listView = getListView();
|
final ListView listView = getListView();
|
||||||
listView.setPadding(20, 30, 20, 30);
|
listView.setPadding(20, 30, 20, 30);
|
||||||
|
|
||||||
// TODO setEmptyView
|
|
||||||
|
|
||||||
View header = getActivity().getLayoutInflater().inflate(R.layout.select_collections_header, null);
|
View header = getActivity().getLayoutInflater().inflate(R.layout.select_collections_header, null);
|
||||||
listView.addHeaderView(header);
|
listView.addHeaderView(header);
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ import org.apache.http.HttpException;
|
|||||||
import org.apache.http.HttpHost;
|
import org.apache.http.HttpHost;
|
||||||
import org.apache.http.HttpRequest;
|
import org.apache.http.HttpRequest;
|
||||||
import org.apache.http.HttpRequestInterceptor;
|
import org.apache.http.HttpRequestInterceptor;
|
||||||
import org.apache.http.auth.AuthScheme;
|
|
||||||
import org.apache.http.auth.AuthScope;
|
import org.apache.http.auth.AuthScope;
|
||||||
import org.apache.http.auth.AuthState;
|
import org.apache.http.auth.AuthState;
|
||||||
import org.apache.http.auth.Credentials;
|
import org.apache.http.auth.Credentials;
|
||||||
|
@ -58,7 +58,6 @@ public class WebDavCollection extends WebDavResource {
|
|||||||
|
|
||||||
/* collection operations */
|
/* collection operations */
|
||||||
|
|
||||||
|
|
||||||
public boolean propfind(HttpPropfind.Mode mode) throws IOException, InvalidDavResponseException, HttpException {
|
public boolean propfind(HttpPropfind.Mode mode) throws IOException, InvalidDavResponseException, HttpException {
|
||||||
HttpPropfind propfind = new HttpPropfind(location, mode);
|
HttpPropfind propfind = new HttpPropfind(location, mode);
|
||||||
HttpResponse response = client.execute(propfind);
|
HttpResponse response = client.execute(propfind);
|
||||||
@ -157,37 +156,30 @@ public class WebDavCollection extends WebDavResource {
|
|||||||
members.clear();
|
members.clear();
|
||||||
|
|
||||||
for (DavResponse singleResponse : multistatus.response) {
|
for (DavResponse singleResponse : multistatus.response) {
|
||||||
String href = singleResponse.getHref().href;
|
URI href;
|
||||||
|
try {
|
||||||
|
href = location.resolve(singleResponse.getHref().href);
|
||||||
|
} catch(IllegalArgumentException ex) {
|
||||||
|
Log.w(TAG, "Ignoring illegal member URI in multi-status response", ex);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// about which resource is this response?
|
||||||
|
WebDavResource referenced = null;
|
||||||
|
if (sameURL(location, href)) { // -> ourselves
|
||||||
|
referenced = this;
|
||||||
|
|
||||||
|
} else { // -> about a member
|
||||||
|
referenced = new WebDavResource(this, href);
|
||||||
|
members.add(referenced);
|
||||||
|
}
|
||||||
|
|
||||||
for (DavPropstat singlePropstat : singleResponse.getPropstat()) {
|
for (DavPropstat singlePropstat : singleResponse.getPropstat()) {
|
||||||
StatusLine status = BasicLineParser.parseStatusLine(singlePropstat.status, new BasicLineParser());
|
StatusLine status = BasicLineParser.parseStatusLine(singlePropstat.status, new BasicLineParser());
|
||||||
|
|
||||||
try {
|
// ignore information about missing properties etc.
|
||||||
checkResponse(status);
|
if (status.getStatusCode()/100 != 1 && status.getStatusCode()/100 != 2)
|
||||||
} catch(NotFoundException e) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
WebDavResource referenced = null;
|
|
||||||
|
|
||||||
URI thisURI;
|
|
||||||
try {
|
|
||||||
thisURI = location.resolve(href);
|
|
||||||
} catch(IllegalArgumentException ex) {
|
|
||||||
Log.w(TAG, "Server returned illegal URI", ex);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sameURL(location, thisURI)) {
|
|
||||||
// response is about this property
|
|
||||||
referenced = this;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// response is about a member, add it
|
|
||||||
URI uri = location.resolve(href);
|
|
||||||
referenced = new WebDavResource(this, uri);
|
|
||||||
members.add(referenced);
|
|
||||||
}
|
|
||||||
|
|
||||||
DavProp prop = singlePropstat.prop;
|
DavProp prop = singlePropstat.prop;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user