1
0
mirror of https://github.com/owncloud/android-library.git synced 2026-08-16 19:03:00 +00:00

Updated CopyRemoteFileOperation constructor

This commit is contained in:
David A. Velasco
2015-08-18 13:27:44 +02:00
parent 6f12324930
commit b281585c93
3 changed files with 4 additions and 24 deletions
@@ -24,7 +24,6 @@
package com.owncloud.android.lib.resources.files;
import android.content.Context;
import android.util.Log;
import com.owncloud.android.lib.common.OwnCloudClient;
@@ -62,7 +61,6 @@ public class CopyRemoteFileOperation extends RemoteOperation {
private String mTargetRemotePath;
private boolean mOverwrite;
private Context mContext;
/**
@@ -73,9 +71,8 @@ public class CopyRemoteFileOperation extends RemoteOperation {
* @param srcRemotePath Remote path of the file/folder to move.
* @param targetRemotePath Remove path desired for the file/folder after moving it.
*/
public CopyRemoteFileOperation(Context context, String srcRemotePath, String targetRemotePath, boolean overwrite
public CopyRemoteFileOperation(String srcRemotePath, String targetRemotePath, boolean overwrite
) {
mContext = context;
mSrcRemotePath = srcRemotePath;
mTargetRemotePath = targetRemotePath;
mOverwrite = overwrite;
@@ -108,10 +105,6 @@ public class CopyRemoteFileOperation extends RemoteOperation {
return new RemoteOperationResult(ResultCode.INVALID_COPY_INTO_DESCENDANT);
}
if (!new ExistenceCheckRemoteOperation(mSrcRemotePath, mContext, Boolean.FALSE).run(getClient()).isSuccess()) {
return new RemoteOperationResult(ResultCode.FILE_NOT_FOUND);
}
/// perform remote operation
CopyMethod copyMethod = null;
RemoteOperationResult result = null;
@@ -136,6 +129,9 @@ public class CopyRemoteFileOperation extends RemoteOperation {
/// for other errors that could be explicitly handled, check first:
/// http://www.webdav.org/specs/rfc4918.html#rfc.section.9.9.4
} else if (status == 400) {
result = new RemoteOperationResult(copyMethod.succeeded(),
copyMethod.getResponseBodyAsString(), status);
} else {
result = new RemoteOperationResult(
isSuccess(status), // copy.succeeded()? trustful?
@@ -39,7 +39,6 @@ import com.owncloud.android.lib.common.network.WebdavUtils;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
@@ -137,7 +136,6 @@ public class MoveRemoteFileOperation extends RemoteOperation {
} else if (status == 400) {
result = new RemoteOperationResult(move.succeeded(),
move.getResponseBodyAsString(), status);
Log_OC.d(TAG, move.getResponseBodyAsString());
} else {
result = new RemoteOperationResult(
isSuccess(status), // move.succeeded()? trustful?