Loading src/main/java/com/nextcloud/android/sso/AccountImporter.java +1 −3 Original line number Diff line number Diff line Loading @@ -130,9 +130,7 @@ public class AccountImporter { if (mPrefs.contains(prefKey)) { try { return SingleSignOnAccount.fromString(mPrefs.getString(prefKey, null)); } catch (ClassNotFoundException e) { Log.e(TAG, "[getSingleSignOnAccount] ClassNotFound", e); } catch (IOException e) { } catch (ClassNotFoundException | IOException e) { Log.e(TAG, "[getSingleSignOnAccount]", e); } } Loading src/main/java/com/nextcloud/android/sso/api/NextcloudRetrofitServiceMethod.java +11 −14 Original line number Diff line number Diff line Loading @@ -44,9 +44,7 @@ import retrofit2.http.Streaming; public class NextcloudRetrofitServiceMethod<T> { private static String TAG = NextcloudRetrofitServiceMethod.class.getCanonicalName(); private final Annotation[] methodAnnotations; private final Annotation[][] parameterAnnotationsArray; private final Type[] parameterTypes; // Upper and lower characters, digits, underscores, and hyphens, starting with a character. Loading @@ -67,8 +65,8 @@ public class NextcloudRetrofitServiceMethod<T> { public NextcloudRetrofitServiceMethod(String apiEndpoint, Method method) { this.method = method; this.returnType = method.getGenericReturnType(); this.methodAnnotations = method.getAnnotations(); this.parameterTypes = method.getGenericParameterTypes(); Annotation[] methodAnnotations = method.getAnnotations(); //Type[] parameterTypes = method.getGenericParameterTypes(); this.parameterAnnotationsArray = method.getParameterAnnotations(); for (Annotation annotation : methodAnnotations) { Loading @@ -91,15 +89,15 @@ public class NextcloudRetrofitServiceMethod<T> { } public T invoke(NextcloudAPI nextcloudAPI, Object[] args) throws Exception { Map<String, String> parameters = new HashMap<>(); if(parameterAnnotationsArray.length != args.length) { throw new InvalidParameterException("Expected: " + parameterAnnotationsArray.length + " params - were: " + args.length); } //NextcloudRequest.Builder rBuilder = (NextcloudRequest.Builder) requestBuilder.clone(); NextcloudRequest.Builder rBuilder = cloneSerializable(requestBuilder); if(parameterAnnotationsArray.length != args.length) { throw new InvalidParameterException("Expected: " + parameterAnnotationsArray.length + " params - were: " + args.length); } Map<String, String> parameters = new HashMap<>(); for(int i = 0; i < parameterAnnotationsArray.length; i++) { Annotation annotation = parameterAnnotationsArray[i][0]; Loading Loading @@ -211,7 +209,6 @@ public class NextcloudRetrofitServiceMethod<T> { this.httpMethod, httpMethod); } this.httpMethod = httpMethod; boolean hasBody1 = hasBody; if (value.isEmpty()) { return; Loading Loading @@ -283,8 +280,8 @@ public class NextcloudRetrofitServiceMethod<T> { private static RuntimeException methodError(Method method, @Nullable Throwable cause, String message, Object... args) { message = String.format(message, args); return new IllegalArgumentException(message String formattedMessage = String.format(message, args); return new IllegalArgumentException(formattedMessage + "\n for method " + method.getDeclaringClass().getSimpleName() + "." Loading Loading @@ -316,7 +313,7 @@ public class NextcloudRetrofitServiceMethod<T> { res = (T) ois.readObject(); } catch (ClassNotFoundException e) { // Can't happen as we just clone an object.. e.printStackTrace(); Log.e(TAG, "ClassNotFoundException", e); } ois.close(); Loading src/main/java/com/nextcloud/android/sso/helper/VersionCheckHelper.java +4 −5 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ import com.nextcloud.android.sso.exceptions.NextcloudFilesAppNotInstalledExcepti import com.nextcloud.android.sso.exceptions.NextcloudFilesAppNotSupportedException; import com.nextcloud.android.sso.ui.UiExceptionManager; public class VersionCheckHelper { public final class VersionCheckHelper { private static final String TAG = VersionCheckHelper.class.getCanonicalName(); Loading @@ -24,8 +24,7 @@ public class VersionCheckHelper { return false; } } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "PackageManager.NameNotFoundException: " + e.getLocalizedMessage()); //e.printStackTrace(); Log.e(TAG, "PackageManager.NameNotFoundException", e); UiExceptionManager.showDialogForException(activity, new NextcloudFilesAppNotInstalledException()); return false; } Loading @@ -34,8 +33,8 @@ public class VersionCheckHelper { } public static int getNextcloudFilesVersionCode(Activity activity) throws PackageManager.NameNotFoundException { PackageInfo pinfo = activity.getPackageManager().getPackageInfo("com.nextcloud.client", 0); int verCode = pinfo.versionCode; PackageInfo pInfo = activity.getPackageManager().getPackageInfo("com.nextcloud.client", 0); int verCode = pInfo.versionCode; Log.e("VersionCheckHelper", "Version Code: " + verCode); return verCode; } Loading src/main/java/com/nextcloud/android/sso/ui/UiExceptionManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ import com.nextcloud.android.sso.exceptions.SSOException; * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class UiExceptionManager { public final class UiExceptionManager { private static final int NOTIFICATION_ID = 0; private static final String CHANNEL_ID = "0"; Loading src/test/java/android/util/Log.java +1 −1 Original line number Diff line number Diff line package android.util; // https://stackoverflow.com/questions/36787449/how-to-mock-method-e-in-log public class Log { public final class Log { private Log() { } Loading Loading
src/main/java/com/nextcloud/android/sso/AccountImporter.java +1 −3 Original line number Diff line number Diff line Loading @@ -130,9 +130,7 @@ public class AccountImporter { if (mPrefs.contains(prefKey)) { try { return SingleSignOnAccount.fromString(mPrefs.getString(prefKey, null)); } catch (ClassNotFoundException e) { Log.e(TAG, "[getSingleSignOnAccount] ClassNotFound", e); } catch (IOException e) { } catch (ClassNotFoundException | IOException e) { Log.e(TAG, "[getSingleSignOnAccount]", e); } } Loading
src/main/java/com/nextcloud/android/sso/api/NextcloudRetrofitServiceMethod.java +11 −14 Original line number Diff line number Diff line Loading @@ -44,9 +44,7 @@ import retrofit2.http.Streaming; public class NextcloudRetrofitServiceMethod<T> { private static String TAG = NextcloudRetrofitServiceMethod.class.getCanonicalName(); private final Annotation[] methodAnnotations; private final Annotation[][] parameterAnnotationsArray; private final Type[] parameterTypes; // Upper and lower characters, digits, underscores, and hyphens, starting with a character. Loading @@ -67,8 +65,8 @@ public class NextcloudRetrofitServiceMethod<T> { public NextcloudRetrofitServiceMethod(String apiEndpoint, Method method) { this.method = method; this.returnType = method.getGenericReturnType(); this.methodAnnotations = method.getAnnotations(); this.parameterTypes = method.getGenericParameterTypes(); Annotation[] methodAnnotations = method.getAnnotations(); //Type[] parameterTypes = method.getGenericParameterTypes(); this.parameterAnnotationsArray = method.getParameterAnnotations(); for (Annotation annotation : methodAnnotations) { Loading @@ -91,15 +89,15 @@ public class NextcloudRetrofitServiceMethod<T> { } public T invoke(NextcloudAPI nextcloudAPI, Object[] args) throws Exception { Map<String, String> parameters = new HashMap<>(); if(parameterAnnotationsArray.length != args.length) { throw new InvalidParameterException("Expected: " + parameterAnnotationsArray.length + " params - were: " + args.length); } //NextcloudRequest.Builder rBuilder = (NextcloudRequest.Builder) requestBuilder.clone(); NextcloudRequest.Builder rBuilder = cloneSerializable(requestBuilder); if(parameterAnnotationsArray.length != args.length) { throw new InvalidParameterException("Expected: " + parameterAnnotationsArray.length + " params - were: " + args.length); } Map<String, String> parameters = new HashMap<>(); for(int i = 0; i < parameterAnnotationsArray.length; i++) { Annotation annotation = parameterAnnotationsArray[i][0]; Loading Loading @@ -211,7 +209,6 @@ public class NextcloudRetrofitServiceMethod<T> { this.httpMethod, httpMethod); } this.httpMethod = httpMethod; boolean hasBody1 = hasBody; if (value.isEmpty()) { return; Loading Loading @@ -283,8 +280,8 @@ public class NextcloudRetrofitServiceMethod<T> { private static RuntimeException methodError(Method method, @Nullable Throwable cause, String message, Object... args) { message = String.format(message, args); return new IllegalArgumentException(message String formattedMessage = String.format(message, args); return new IllegalArgumentException(formattedMessage + "\n for method " + method.getDeclaringClass().getSimpleName() + "." Loading Loading @@ -316,7 +313,7 @@ public class NextcloudRetrofitServiceMethod<T> { res = (T) ois.readObject(); } catch (ClassNotFoundException e) { // Can't happen as we just clone an object.. e.printStackTrace(); Log.e(TAG, "ClassNotFoundException", e); } ois.close(); Loading
src/main/java/com/nextcloud/android/sso/helper/VersionCheckHelper.java +4 −5 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ import com.nextcloud.android.sso.exceptions.NextcloudFilesAppNotInstalledExcepti import com.nextcloud.android.sso.exceptions.NextcloudFilesAppNotSupportedException; import com.nextcloud.android.sso.ui.UiExceptionManager; public class VersionCheckHelper { public final class VersionCheckHelper { private static final String TAG = VersionCheckHelper.class.getCanonicalName(); Loading @@ -24,8 +24,7 @@ public class VersionCheckHelper { return false; } } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "PackageManager.NameNotFoundException: " + e.getLocalizedMessage()); //e.printStackTrace(); Log.e(TAG, "PackageManager.NameNotFoundException", e); UiExceptionManager.showDialogForException(activity, new NextcloudFilesAppNotInstalledException()); return false; } Loading @@ -34,8 +33,8 @@ public class VersionCheckHelper { } public static int getNextcloudFilesVersionCode(Activity activity) throws PackageManager.NameNotFoundException { PackageInfo pinfo = activity.getPackageManager().getPackageInfo("com.nextcloud.client", 0); int verCode = pinfo.versionCode; PackageInfo pInfo = activity.getPackageManager().getPackageInfo("com.nextcloud.client", 0); int verCode = pInfo.versionCode; Log.e("VersionCheckHelper", "Version Code: " + verCode); return verCode; } Loading
src/main/java/com/nextcloud/android/sso/ui/UiExceptionManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ import com.nextcloud.android.sso.exceptions.SSOException; * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class UiExceptionManager { public final class UiExceptionManager { private static final int NOTIFICATION_ID = 0; private static final String CHANNEL_ID = "0"; Loading
src/test/java/android/util/Log.java +1 −1 Original line number Diff line number Diff line package android.util; // https://stackoverflow.com/questions/36787449/how-to-mock-method-e-in-log public class Log { public final class Log { private Log() { } Loading