Add check of characters in file name before starting rename/createFolder operations
[pub/Android/ownCloud.git] / src / com / owncloud / android / files / services / FileObserverService.java
index a01446a..871d2ab 100644 (file)
@@ -22,13 +22,14 @@ import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
 
-import com.owncloud.android.Log_OC;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
 import com.owncloud.android.files.OwnCloudFileObserver;
 import com.owncloud.android.operations.SynchronizeFileOperation;
 import com.owncloud.android.utils.FileStorageUtils;
+import com.owncloud.android.utils.Log_OC;
+
 
 import android.accounts.Account;
 import android.accounts.AccountManager;
@@ -40,7 +41,6 @@ import android.content.IntentFilter;
 import android.database.Cursor;
 import android.os.Binder;
 import android.os.IBinder;
-import android.util.Log;
 
 public class FileObserverService extends Service {
 
@@ -57,7 +57,7 @@ public class FileObserverService extends Service {
     private static Map<String, OwnCloudFileObserver> mObserversMap;
     private static DownloadCompletedReceiverBis mDownloadReceiver;
     private IBinder mBinder = new LocalBinder();
-
+    
     public class LocalBinder extends Binder {
         FileObserverService getService() {
             return FileObserverService.this;
@@ -68,9 +68,10 @@ public class FileObserverService extends Service {
     public void onCreate() {
         super.onCreate();
         mDownloadReceiver = new DownloadCompletedReceiverBis();
+        
         IntentFilter filter = new IntentFilter();
-        filter.addAction(FileDownloader.DOWNLOAD_ADDED_MESSAGE);
-        filter.addAction(FileDownloader.DOWNLOAD_FINISH_MESSAGE);        
+        filter.addAction(FileDownloader.getDownloadAddedMessage());
+        filter.addAction(FileDownloader.getDownloadFinishMessage());        
         registerReceiver(mDownloadReceiver, filter);
         
         mObserversMap = new HashMap<String, OwnCloudFileObserver>();
@@ -260,12 +261,12 @@ public class FileObserverService extends Service {
             String downloadPath = intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH);
             OwnCloudFileObserver observer = mObserversMap.get(downloadPath);
             if (observer != null) {
-                if (intent.getAction().equals(FileDownloader.DOWNLOAD_FINISH_MESSAGE) &&
+                if (intent.getAction().equals(FileDownloader.getDownloadFinishMessage()) &&
                         new File(downloadPath).exists()) {  // the download could be successful. not; in both cases, the file could be down, due to a former download or upload   
                     observer.startWatching();
                     Log_OC.d(TAG, "Watching again " + downloadPath);
                 
-                } else if (intent.getAction().equals(FileDownloader.DOWNLOAD_ADDED_MESSAGE)) {
+                } else if (intent.getAction().equals(FileDownloader.getDownloadAddedMessage())) {
                     observer.stopWatching();
                     Log_OC.d(TAG, "Disabling observance of " + downloadPath);
                 }