1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-08 00:16:09 +00:00

OC-2678: Consider CreateShareRemoteOperation returns result!=null in exceptions

This commit is contained in:
masensio 2014-01-31 12:25:39 +01:00
parent 30a5eedf7e
commit 81acfb9571

View File

@ -102,8 +102,11 @@ public class CreateShareRemoteOperation extends RemoteOperation {
RemoteOperationResult result = null; RemoteOperationResult result = null;
int status = -1; int status = -1;
PostMethod post = null;
try {
// Post Method // Post Method
PostMethod post = new PostMethod(client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE); post = new PostMethod(client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE);
Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE); Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE);
post.addParameter(PARAM_PATH, mPath); post.addParameter(PARAM_PATH, mPath);
@ -113,7 +116,6 @@ public class CreateShareRemoteOperation extends RemoteOperation {
post.addParameter(PARAM_PASSWORD, mPassword); post.addParameter(PARAM_PASSWORD, mPassword);
post.addParameter(PARAM_PERMISSIONS, Integer.toString(mPermissions)); post.addParameter(PARAM_PERMISSIONS, Integer.toString(mPermissions));
try {
status = client.executeMethod(post); status = client.executeMethod(post);
if(isSuccess(status)) { if(isSuccess(status)) {
@ -138,13 +140,19 @@ public class CreateShareRemoteOperation extends RemoteOperation {
result.setData(sharesObjects); result.setData(sharesObjects);
} }
} else {
result = new RemoteOperationResult(false, status, post.getResponseHeaders());
} }
} catch (Exception e) { } catch (Exception e) {
result = new RemoteOperationResult(e); result = new RemoteOperationResult(e);
Log.e(TAG, "Exception while Creating New Share", e); Log.e(TAG, "Exception while Creating New Share", e);
} finally { } finally {
if (post != null) {
post.releaseConnection(); post.releaseConnection();
} }
}
return result; return result;
} }