Browse Source

codacy: Use one line for each declaration, it enhances code readability.

AndyScherzinger 8 years ago
parent
commit
e85f1592e2

+ 2 - 1
src/main/java/com/owncloud/android/authentication/AccountUtils.java

@@ -96,7 +96,8 @@ public class AccountUtils {
             int lastAtPos = account.name.lastIndexOf("@");
             String hostAndPort = account.name.substring(lastAtPos + 1);
             String username = account.name.substring(0, lastAtPos);
-            String otherHostAndPort, otherUsername;
+            String otherHostAndPort;
+            String otherUsername;
             Locale currentLocale = context.getResources().getConfiguration().locale;
             for (Account otherAccount : ocAccounts) {
                 lastAtPos = otherAccount.name.lastIndexOf("@");

+ 5 - 2
src/main/java/com/owncloud/android/files/services/FileUploader.java

@@ -302,7 +302,8 @@ public class FileUploader extends Service
             UploadsStorageManager uploadsStorageManager = new UploadsStorageManager(context.getContentResolver(), context);
             OCUpload[] failedUploads = uploadsStorageManager.getFailedUploads();
             Account currentAccount = null;
-            boolean resultMatch, accountMatch;
+            boolean resultMatch;
+            boolean accountMatch;
             for ( OCUpload failedUpload: failedUploads) {
                 accountMatch = (account == null || account.name.equals(failedUpload.getAccountName()));
                 resultMatch = (uploadResult == null || uploadResult.equals(failedUpload.getLastResult()));
@@ -434,7 +435,9 @@ public class FileUploader extends Service
                 return Service.START_NOT_STICKY;
             }
 
-            String[] localPaths = null, remotePaths = null, mimeTypes = null;
+            String[] localPaths = null;
+            String[] remotePaths = null;
+            String[] mimeTypes = null;
             OCFile[] files = null;
 
             if (intent.hasExtra(KEY_FILE)) {

+ 5 - 3
src/main/java/com/owncloud/android/files/services/IndexedForest.java

@@ -41,13 +41,13 @@ import java.util.concurrent.ConcurrentMap;
  */
 public class IndexedForest<V> {
 
-    private ConcurrentMap<String, Node<V>> mMap = new ConcurrentHashMap<String, Node<V>>();
+    private ConcurrentMap<String, Node<V>> mMap = new ConcurrentHashMap<>();
 
     @SuppressWarnings("PMD.ShortClassName")
     private class Node<V> {
         String mKey = null;
         Node<V> mParent = null;
-        Set<Node<V>> mChildren = new HashSet<Node<V>>();    // TODO be careful with hash()
+        Set<Node<V>> mChildren = new HashSet<>();    // TODO be careful with hash()
         V mPayload = null;
 
         // payload is optional
@@ -112,7 +112,9 @@ public class IndexedForest<V> {
 
         } else {
             // value really added
-            String currentPath = remotePath, parentPath = null, parentKey = null;
+            String currentPath = remotePath;
+            String parentPath = null;
+            String parentKey = null;
             Node<V> currentNode = valuedNode, parentNode = null;
             boolean linked = false;
             while (!OCFile.ROOT_PATH.equals(currentPath) && !linked) {

+ 3 - 1
src/main/java/com/owncloud/android/operations/RefreshFolderOperation.java

@@ -375,7 +375,9 @@ public class RefreshFolderOperation extends RemoteOperation {
         }
         
         // loop to update every child
-        OCFile remoteFile = null, localFile = null, updatedFile = null;
+        OCFile remoteFile = null;
+        OCFile localFile = null;
+        OCFile updatedFile = null;
         RemoteFile r;
         for (int i=1; i<folderAndFiles.size(); i++) {
             /// new OCFile instance with the data from the server

+ 3 - 1
src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java

@@ -288,7 +288,9 @@ public class SynchronizeFolderOperation extends SyncOperation {
         }
 
         // loop to synchronize every child
-        OCFile remoteFile = null, localFile = null, updatedFile = null;
+        OCFile remoteFile = null;
+        OCFile localFile = null;
+        OCFile updatedFile = null;
         RemoteFile r;
         for (int i=1; i<folderAndFiles.size(); i++) {
             /// new OCFile instance with the data from the server

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

@@ -294,7 +294,9 @@ public class UploadFileOperation extends SyncOperation {
         mCancellationRequested.set(false);
         mUploadStarted.set(true);
         RemoteOperationResult result = null;
-        File temporalFile = null, originalFile = new File(mOriginalStoragePath), expectedFile = null;
+        File temporalFile = null;
+        File originalFile = new File(mOriginalStoragePath);
+        File expectedFile = null;
 
         try {
 

+ 5 - 1
src/main/java/com/owncloud/android/providers/FileContentProvider.java

@@ -1131,7 +1131,11 @@ public class FileContentProvider extends ContentProvider {
             // AccountManager are not synchronous
             Account[] accounts = AccountManager.get(getContext()).getAccountsByType(
                     MainApp.getAccountType());
-            String serverUrl, username, oldAccountName, newAccountName;
+            String serverUrl;
+            String username;
+            String oldAccountName;
+            String newAccountName;
+
             for (Account account : accounts) {
                 // build both old and new account name
                 serverUrl = ama.getUserData(account, AccountUtils.Constants.KEY_OC_BASE_URL);

+ 2 - 1
src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -1020,7 +1020,8 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
 
     private void updateFooter() {
         if (!mJustFolders) {
-            int filesCount = 0, foldersCount = 0;
+            int filesCount = 0;
+            int foldersCount = 0;
             int count = mAdapter.getCount();
             OCFile file;
             for (int i = 0; i < count; i++) {