mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	Updated CopyRemoteFileOperation constructor
This commit is contained in:
		
							parent
							
								
									6f12324930
								
							
						
					
					
						commit
						b281585c93
					
				| @ -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? | ||||
|  | ||||
| @ -277,7 +277,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // copy file | ||||
|         CopyRemoteFileOperation copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FILE_1, | ||||
|                 TARGET_PATH_TO_FILE_1, | ||||
|                 false | ||||
| @ -287,7 +286,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // copy & rename file, different location | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FILE_2, | ||||
|                 TARGET_PATH_TO_FILE_2_RENAMED, | ||||
|                 false | ||||
| @ -297,7 +295,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // copy & rename file, same location (rename file) | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FILE_3, | ||||
|                 SRC_PATH_TO_FILE_3_RENAMED, | ||||
|                 false | ||||
| @ -307,7 +304,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // copy empty folder | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_EMPTY_FOLDER, | ||||
|                 TARGET_PATH_TO_EMPTY_FOLDER, | ||||
|                 false | ||||
| @ -317,7 +313,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // copy non-empty folder | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FULL_FOLDER_1, | ||||
|                 TARGET_PATH_TO_FULL_FOLDER_1, | ||||
|                 false | ||||
| @ -327,7 +322,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // copy & rename folder, different location | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FULL_FOLDER_2, | ||||
|                 TARGET_PATH_TO_FULL_FOLDER_2_RENAMED, | ||||
|                 false | ||||
| @ -337,7 +331,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // copy & rename folder, same location (rename folder) | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FULL_FOLDER_3, | ||||
|                 SRC_PATH_TO_FULL_FOLDER_3_RENAMED, | ||||
|                 false | ||||
| @ -347,7 +340,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // copy for nothing (success, but no interaction with network) | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FILE_4, | ||||
|                 SRC_PATH_TO_FILE_4, | ||||
|                 false | ||||
| @ -357,7 +349,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // copy overwriting | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FULL_FOLDER_4, | ||||
|                 TARGET_PATH_TO_ALREADY_EXISTENT_EMPTY_FOLDER_4, | ||||
|                 true | ||||
| @ -370,7 +361,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // file to copy does not exist | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_NON_EXISTENT_FILE, | ||||
|                 TARGET_PATH_TO_NON_EXISTENT_FILE, | ||||
|                 false | ||||
| @ -380,7 +370,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // folder to copy into does no exist | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FILE_5, | ||||
|                 TARGET_PATH_TO_FILE_5_INTO_NON_EXISTENT_FOLDER, | ||||
|                 false | ||||
| @ -390,7 +379,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // target location (renaming) has invalid characters | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FILE_6, | ||||
|                 TARGET_PATH_RENAMED_WITH_INVALID_CHARS, | ||||
|                 false | ||||
| @ -400,7 +388,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // name collision | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_PATH_TO_FILE_1, | ||||
|                 TARGET_PATH_TO_ALREADY_EXISTENT_FILE_7, | ||||
|                 false | ||||
| @ -410,7 +397,6 @@ public class CopyFileTest extends ActivityInstrumentationTestCase2<TestActivity> | ||||
| 
 | ||||
|         // copy a folder into a descendant | ||||
|         copyOperation = new CopyRemoteFileOperation( | ||||
|                 getContext(), | ||||
|                 SRC_BASE_FOLDER, | ||||
|                 SRC_PATH_TO_EMPTY_FOLDER, | ||||
|                 false | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user