浏览代码

Reformat if / try to make Codecy happy

It's nicer to put the try inside the if, anyway.

Signed-off-by: Christian Tacke <8560110+ChristianTacke@users.noreply.github.com>
Christian Tacke 4 年之前
父节点
当前提交
1974689974
共有 1 个文件被更改,包括 10 次插入11 次删除
  1. 10 11
      src/main/java/com/owncloud/android/ui/asynctasks/CopyAndUploadContentUrisTask.java

+ 10 - 11
src/main/java/com/owncloud/android/ui/asynctasks/CopyAndUploadContentUrisTask.java

@@ -157,7 +157,7 @@ public class CopyAndUploadContentUrisTask extends AsyncTask<Object, Void, Result
                                 DocumentsContract.Document.COLUMN_LAST_MODIFIED));
                                 DocumentsContract.Document.COLUMN_LAST_MODIFIED));
                     }
                     }
                 }
                 }
-                
+
                 fullTempPath = FileStorageUtils.getTemporalPath(account.name) + currentRemotePath;
                 fullTempPath = FileStorageUtils.getTemporalPath(account.name) + currentRemotePath;
                 inputStream = leakedContentResolver.openInputStream(currentUri);
                 inputStream = leakedContentResolver.openInputStream(currentUri);
                 File cacheFile = new File(fullTempPath);
                 File cacheFile = new File(fullTempPath);
@@ -173,20 +173,19 @@ public class CopyAndUploadContentUrisTask extends AsyncTask<Object, Void, Result
                 while ((count = inputStream.read(buffer)) > 0) {
                 while ((count = inputStream.read(buffer)) > 0) {
                     outputStream.write(buffer, 0, count);
                     outputStream.write(buffer, 0, count);
                 }
                 }
-                
-                try {
-                    if(lastModified != 0 ){
-                        
-                        if(!cacheFile.setLastModified(lastModified)){
+ 
+                if (lastModified != 0) {
+                    try {
+                        if (!cacheFile.setLastModified(lastModified)) {
                             Log_OC.w(TAG, "Could not change mtime of cacheFile");
                             Log_OC.w(TAG, "Could not change mtime of cacheFile");
                         }
                         }
+                    } catch (SecurityException e) {
+                        Log_OC.e(TAG, "Not enough permissions to change mtime of cacheFile", e);
+                    } catch (IllegalArgumentException e) {
+                        Log_OC.e(TAG, "Could not change mtime of cacheFile, mtime is negativ: "+lastModified, e);
                     }
                     }
-                }catch (SecurityException e) {
-                    Log_OC.e(TAG, "Not enough permissions to change mtime of cacheFile", e);
-                }catch (IllegalArgumentException e) {
-                    Log_OC.e(TAG, "Could not change mtime of cacheFile, mtime is negativ: "+lastModified, e);
                 }
                 }
-                
+
                 requestUpload(
                 requestUpload(
                     account,
                     account,
                     fullTempPath,
                     fullTempPath,