Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf60f839 authored by David Luhmer's avatar David Luhmer
Browse files

refactor codacy issues

parent d98c2cfd
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ public class AccountImporter {
    public static final int CHOOSE_ACCOUNT_SSO = 4242;
    public static final int REQUEST_AUTH_TOKEN_SSO = 4243;

    public static boolean AccountsToImportAvailable(Context context) {
    public static boolean accountsToImportAvailable(Context context) {
        return findAccounts(context).size() > 0;
    }

@@ -96,7 +96,7 @@ public class AccountImporter {

        List<Account> accountsAvailable = new ArrayList<>();
        for (final Account account : accounts) {
            if (account.type.equals("nextcloud")) {
            if ("nextcloud".equals(account.type)) {
                accountsAvailable.add(account);
            }
        }
@@ -131,10 +131,9 @@ public class AccountImporter {
            try {
                return SingleSignOnAccount.fromString(mPrefs.getString(prefKey, null));
            } catch (ClassNotFoundException e) {
                Log.e(TAG, "This should never happen!");
                e.printStackTrace();
                Log.e(TAG, "[getSingleSignOnAccount] ClassNotFound", e);
            } catch (IOException e) {
                e.printStackTrace();
                Log.e(TAG, "[getSingleSignOnAccount]", e);
            }
        }
        throw new NextcloudFilesAppAccountNotFoundException();
+5 −4
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ import java.io.OutputStream;

public class ParcelFileDescriptorUtil {

    private ParcelFileDescriptorUtil() { }

    public static ParcelFileDescriptor pipeFrom(InputStream inputStream, IThreadListener listener)
            throws IOException {
        ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe();
@@ -80,18 +82,17 @@ public class ParcelFileDescriptorUtil {
                }
                mOut.flush(); // just to be safe
            } catch (IOException e) {
                Log.e("TransferThread", "writing failed");
                e.printStackTrace();
                Log.e("TransferThread", "writing failed", e);
            } finally {
                try {
                    mIn.close();
                } catch (IOException e) {
                    e.printStackTrace();
                    Log.e("TransferThread", "closing 'in' failed", e);
                }
                try {
                    mOut.close();
                } catch (IOException e) {
                    e.printStackTrace();
                    Log.e("TransferThread", "closing 'out' failed", e);
                }
            }
            if (mListener != null)
+0 −2
Original line number Diff line number Diff line
@@ -21,10 +21,8 @@ import java.lang.reflect.Type;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

+8 −2
Original line number Diff line number Diff line
@@ -27,14 +27,16 @@ import java.util.concurrent.Callable;

public class AsyncTaskHelper {

    private AsyncTaskHelper() { }

    @RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
    public static <T> T ExecuteBlockingRequest(Callable<T> callable) throws Exception {
        GenericAsyncTaskWithCallable<T> at = new GenericAsyncTaskWithCallable<>(callable);

        T result = at.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR).get();

        if (at.exception != null) {
            throw at.exception;
        if (at.getException() != null) {
            throw at.getException();
        }

        return result;
@@ -58,6 +60,10 @@ public class AsyncTaskHelper {
                return null;
            }
        }

        private Exception getException() {
            return exception;
        }
    }

}
+0 −1
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ public final class Okhttp3Helper {
            return ResponseBody.create(null, 0, new BufferedSourceSSO(os));
        } catch (Exception e) {
            Log.e(TAG, "[getResponseBodyFromRequest] encountered a problem", e);
            e.printStackTrace();
        }
        return ResponseBody.create(null, "");
    }
Loading