From e0802a0da483c0f1992fd1ebfae91ef9e742e56d Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 14 Oct 2019 14:45:50 +0200 Subject: [PATCH] codacy: Avoid using Literals in Conditional Statements Signed-off-by: Andy Scherzinger --- .../com/owncloud/android/providers/FileContentProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/providers/FileContentProvider.java b/src/main/java/com/owncloud/android/providers/FileContentProvider.java index 421073dd95..bcfe381e53 100644 --- a/src/main/java/com/owncloud/android/providers/FileContentProvider.java +++ b/src/main/java/com/owncloud/android/providers/FileContentProvider.java @@ -89,6 +89,7 @@ public class FileContentProvider extends ContentProvider { private static final String UPGRADE_VERSION_MSG = "OUT of the ADD in onUpgrade; oldVersion == %d, newVersion == %d"; private static final int SINGLE_PATH_SEGMENT = 1; public static final int ARBITRARY_DATA_TABLE_INTRODUCTION_VERSION = 20; + public static final int MINIMUM_PATH_SEGMENTS_SIZE = 1; private DataBaseHelper mDbHelper; private Context mContext; @@ -186,7 +187,7 @@ public class FileContentProvider extends ContentProvider { children.close(); } - if (uri.getPathSegments().size() > 1) { + if (uri.getPathSegments().size() > MINIMUM_PATH_SEGMENTS_SIZE) { count += db.delete(ProviderTableMeta.FILE_TABLE_NAME, ProviderTableMeta._ID + "=" + uri.getPathSegments().get(1) + (!TextUtils.isEmpty(where) ? " AND (" + where + ")" : ""), whereArgs);