Add user agent in android project
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / UploadFileOperation.java
index bf0d060..d531618 100644 (file)
@@ -1,5 +1,8 @@
-/* ownCloud Android client application
- *   Copyright (C) 2012-2015 ownCloud Inc.
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -26,7 +29,6 @@ import java.io.OutputStream;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
-import java.util.concurrent.CancellationException;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.commons.httpclient.methods.PutMethod;
@@ -56,8 +58,6 @@ import com.owncloud.android.utils.UriUtils;
 
 /**
  * Remote operation performing the upload of a file to an ownCloud server
- * 
- * @author David A. Velasco
  */
 public class UploadFileOperation extends RemoteOperation {
 
@@ -93,7 +93,8 @@ public class UploadFileOperation extends RemoteOperation {
                                 int localBehaviour, 
                                 Context context) {
         if (account == null)
-            throw new IllegalArgumentException("Illegal NULL account in UploadFileOperation creation");
+            throw new IllegalArgumentException("Illegal NULL account in UploadFileOperation " +
+                    "creation");
         if (file == null)
             throw new IllegalArgumentException("Illegal NULL file in UploadFileOperation creation");
         if (file.getStoragePath() == null || file.getStoragePath().length() <= 0) {
@@ -321,7 +322,7 @@ public class UploadFileOperation extends RemoteOperation {
                 mUploadOperation.addDatatransferProgressListener(listener.next());
             }
             if (!mCancellationRequested.get()) {
-                result = mUploadOperation.execute(client);
+                result = mUploadOperation.execute(client, MainApp.getUserAgent());
 
                 /// move local temporal file or original file to its corresponding
                 // location in the ownCloud local folder
@@ -458,7 +459,7 @@ public class UploadFileOperation extends RemoteOperation {
     private boolean existsFile(OwnCloudClient client, String remotePath){
         ExistenceCheckRemoteOperation existsOperation =
                 new ExistenceCheckRemoteOperation(remotePath, mContext, false);
-        RemoteOperationResult result = existsOperation.execute(client);
+        RemoteOperationResult result = existsOperation.execute(client, MainApp.getUserAgent());
         return result.isSuccess();
     }