mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Granted that GetRemoteSharesOperation returns a result when the server responses with an error
This commit is contained in:
parent
8ab453d630
commit
d731ff0e66
@ -25,14 +25,11 @@
|
|||||||
package com.owncloud.android.lib.operations.remote;
|
package com.owncloud.android.lib.operations.remote;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.apache.commons.httpclient.HttpException;
|
|
||||||
import org.apache.commons.httpclient.methods.GetMethod;
|
import org.apache.commons.httpclient.methods.GetMethod;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
import com.owncloud.android.lib.network.OwnCloudClient;
|
import com.owncloud.android.lib.network.OwnCloudClient;
|
||||||
import com.owncloud.android.lib.operations.common.RemoteOperation;
|
import com.owncloud.android.lib.operations.common.RemoteOperation;
|
||||||
@ -70,11 +67,12 @@ public class GetRemoteSharesOperation extends RemoteOperation {
|
|||||||
int status = -1;
|
int status = -1;
|
||||||
|
|
||||||
// Get Method
|
// Get Method
|
||||||
GetMethod get = new GetMethod(client.getBaseUri() + SHAREAPI_ROUTE);
|
GetMethod get = null;
|
||||||
Log.d(TAG, "URL ------> " + client.getBaseUri() + SHAREAPI_ROUTE);
|
|
||||||
|
|
||||||
// Get the response
|
// Get the response
|
||||||
try{
|
try{
|
||||||
|
get = new GetMethod(client.getBaseUri() + SHAREAPI_ROUTE);
|
||||||
|
Log.d(TAG, "URL ------> " + client.getBaseUri() + SHAREAPI_ROUTE);
|
||||||
status = client.executeMethod(get);
|
status = client.executeMethod(get);
|
||||||
if(isSuccess(status)) {
|
if(isSuccess(status)) {
|
||||||
Log.d(TAG, "Obtain RESPONSE");
|
Log.d(TAG, "Obtain RESPONSE");
|
||||||
@ -95,18 +93,18 @@ public class GetRemoteSharesOperation extends RemoteOperation {
|
|||||||
}
|
}
|
||||||
result.setData(sharesObjects);
|
result.setData(sharesObjects);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
result = new RemoteOperationResult(false, status, get.getResponseHeaders());
|
||||||
}
|
}
|
||||||
} catch (HttpException e) {
|
|
||||||
|
} catch (Exception e) {
|
||||||
result = new RemoteOperationResult(e);
|
result = new RemoteOperationResult(e);
|
||||||
e.printStackTrace();
|
Log.e(TAG, "Exception while getting remote shares ", e);
|
||||||
} catch (IOException e) {
|
|
||||||
result = new RemoteOperationResult(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (XmlPullParserException e) {
|
|
||||||
result = new RemoteOperationResult(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
} finally {
|
||||||
get.releaseConnection();
|
if (get != null) {
|
||||||
|
get.releaseConnection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user