Browse Source

codacy: This statement should have braces

AndyScherzinger 6 years ago
parent
commit
5f10a9301b

+ 3 - 5
src/main/java/com/owncloud/android/operations/UploadFileOperation.java

@@ -699,12 +699,10 @@ public class UploadFileOperation extends SyncOperation {
 
     private RemoteOperationResult unlockFolder(OCFile parentFolder, OwnCloudClient client, String token) {
         if (token != null) {
-            UnlockFileOperation unlockFileOperation = new UnlockFileOperation(parentFolder.getLocalId(), token);
-            RemoteOperationResult unlockFileOperationResult = unlockFileOperation.execute(client, true);
-
-            return unlockFileOperationResult;
-        } else
+            return new UnlockFileOperation(parentFolder.getLocalId(), token).execute(client, true);
+        } else {
             return new RemoteOperationResult(new Exception("No token available"));
+        }
     }
 
     private RemoteOperationResult checkConditions(File originalFile) {

+ 6 - 2
src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

@@ -538,10 +538,14 @@ public class ReceiveExternalFilesActivity extends FileActivity
 
         private boolean isIntentFromGoogleMap(String subjectText, String extraText) {
             String texts[] = extraText.split("\n");
-            if (texts.length != 3)
+            if (texts.length != 3) {
                 return false;
-            if (texts[0].length() == 0 || !subjectText.equals(texts[0]))
+            }
+
+            if (texts[0].length() == 0 || !subjectText.equals(texts[0])) {
                 return false;
+            }
+
             return texts[2].startsWith("https://goo.gl/maps/");
         }
 

+ 2 - 1
src/main/java/com/owncloud/android/ui/activity/StorageMigration.java

@@ -274,8 +274,9 @@ public class StorageMigration {
             // probably migration failed even before saving states,
             // which is weird and should be investigated.
             // But its better than crashing on ArrayOutOfBounds.
-            if (oldSync == null)
+            if (oldSync == null) {
                 return;
+            }
             for (int i = 0; i < mOcAccounts.length; ++i) {
                 ContentResolver.setSyncAutomatically(mOcAccounts[i], mAuthority, oldSync[i]);
             }

+ 2 - 1
src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java

@@ -301,8 +301,9 @@ public class UserInfoActivity extends FileActivity {
 
     private void addToListIfNeeded(List<UserInfoDetailsItem> info, @DrawableRes int icon, String text,
                                    @StringRes int contentDescriptionInt) {
-        if (!TextUtils.isEmpty(text))
+        if (!TextUtils.isEmpty(text)) {
             info.add(new UserInfoDetailsItem(icon, text, getResources().getString(contentDescriptionInt)));
+        }
     }
 
     public static void openAccountRemovalConfirmationDialog(Account account, FragmentManager fragmentManager,

+ 2 - 2
src/main/java/com/owncloud/android/ui/adapter/ActivityAndVersionListAdapter.java

@@ -127,9 +127,9 @@ public class ActivityAndVersionListAdapter extends ActivityListAdapter {
     public int getItemViewType(int position) {
         Object value = values.get(position);
 
-        if (value instanceof Activity)
+        if (value instanceof Activity) {
             return ACTIVITY_TYPE;
-        else if (value instanceof FileVersion) {
+        } else if (value instanceof FileVersion) {
             return VERSION_TYPE;
         } else {
             return HEADER_TYPE;

+ 5 - 3
src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java

@@ -332,8 +332,9 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
 
     private RichObject searchObjectByName(List<RichObject> richObjectList, String name) {
         for (RichObject richObject : richObjectList) {
-            if (richObject.getTag().equalsIgnoreCase(name))
+            if (richObject.getTag().equalsIgnoreCase(name)) {
                 return richObject;
+            }
         }
         return null;
     }
@@ -341,10 +342,11 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
 
     @Override
     public int getItemViewType(int position) {
-        if (values.get(position) instanceof Activity)
+        if (values.get(position) instanceof Activity) {
             return ACTIVITY_TYPE;
-        else
+        } else {
             return HEADER_TYPE;
+        }
     }
 
     @Override

+ 7 - 3
src/main/java/com/owncloud/android/utils/svg/SvgDecoder.java

@@ -41,11 +41,15 @@ public class SvgDecoder implements ResourceDecoder<InputStream, SVG> {
         try {
             SVG svg = SVG.getFromInputStream(source);
 
-            if (width > 0) svg.setDocumentWidth(width);
-            if (height > 0) svg.setDocumentHeight(height);
+            if (width > 0) {
+                svg.setDocumentWidth(width);
+            }
+            if (height > 0) {
+                svg.setDocumentHeight(height);
+            }
             svg.setDocumentPreserveAspectRatio(PreserveAspectRatio.LETTERBOX);
 
-            return new SimpleResource<SVG>(svg);
+            return new SimpleResource<>(svg);
         } catch (SVGParseException ex) {
             throw new IOException("Cannot load SVG from stream", ex);
         }