Fixed NullPointerExceptionS in upload cancelations
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / SynchronizeFileOperation.java
index 08481d1..d7c49f0 100644 (file)
@@ -197,7 +197,7 @@ public class SynchronizeFileOperation extends SyncOperation {
 
             if (mServerFile == null) {
                 ReadRemoteFileOperation operation = new ReadRemoteFileOperation(mRemotePath);
-                result = operation.execute(client, MainApp.getUserAgent());
+                result = operation.execute(client);
                 if (result.isSuccess()){
                     mServerFile = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
                     mServerFile.setLastSyncDateForProperties(System.currentTimeMillis());
@@ -221,6 +221,12 @@ public class SynchronizeFileOperation extends SyncOperation {
                     mLocalFile.getLocalModificationTimestamp() > mLocalFile.getLastSyncDateForData()
                 );
 
+                Log_OC.d(TAG, "TOKENs checked to SYNC " + mRemotePath );
+                Log_OC.d(TAG, "  server#modificationTimestamp " + mServerFile.getModificationTimestamp());
+                Log_OC.d(TAG, "  local#modificationTimestampAtLastSyncForData " + mServerFile.getModificationTimestampAtLastSyncForData());
+                Log_OC.d(TAG, "  local#modificationTimestamp " + mLocalFile.getLocalModificationTimestamp());
+                Log_OC.d(TAG, "  local#lastSyncDateForData " + mLocalFile.getLastSyncDateForData());
+
                 /// decide action to perform depending upon changes
                 //if (!mLocalFile.getEtag().isEmpty() && localChanged && serverChanged) {
                 if (localChanged && serverChanged) {
@@ -245,12 +251,12 @@ public class SynchronizeFileOperation extends SyncOperation {
                     
                     if (mSyncFileContents) {
                         requestForDownload(mLocalFile); // local, not server; we won't to keep
-                        // the value of keepInSync!
+                        // the value of favorite!
                         // the update of local data will be done later by the FileUploader
                         // service when the upload finishes
                     } else {
                         // TODO CHECK: is this really useful in some point in the code?
-                        mServerFile.setKeepInSync(mLocalFile.keepInSync());
+                        mServerFile.setFavorite(mLocalFile.isFavorite());
                         mServerFile.setLastSyncDateForData(mLocalFile.getLastSyncDateForData());
                         mServerFile.setStoragePath(mLocalFile.getStoragePath());
                         mServerFile.setParentId(mLocalFile.getParentId());
@@ -285,7 +291,7 @@ public class SynchronizeFileOperation extends SyncOperation {
         i.putExtra(FileUploader.KEY_ACCOUNT, mAccount);
         i.putExtra(FileUploader.KEY_FILE, file);
         /*i.putExtra(FileUploader.KEY_REMOTE_FILE, mRemotePath);
-        // doing this we would lose the value of keepInSync in the road, and maybe
+        // doing this we would lose the value of isFavorite in the road, and maybe
         // it's not updated in the database when the FileUploader service gets it!
         i.putExtra(FileUploader.KEY_LOCAL_FILE, localFile.getStoragePath());*/
         i.putExtra(FileUploader.KEY_UPLOAD_TYPE, FileUploader.UPLOAD_SINGLE_FILE);