X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fhelpers%2FBookmarksDatabaseHelper.java;h=529a769b8d03bbf26539b59895ba35540f8a8bc5;hp=984402e826a077877b8117e0323d5a8e19a4b243;hb=b82022327701273b1b56419e8d6042895c0bc7b9;hpb=0488649384ddea89d768c1fc1cc5fb71f8af6528 diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/BookmarksDatabaseHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/BookmarksDatabaseHelper.java index 984402e8..529a769b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/BookmarksDatabaseHelper.java +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/BookmarksDatabaseHelper.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2019 Soren Stoutner . + * Copyright © 2016-2020 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -334,12 +334,14 @@ public class BookmarksDatabaseHelper extends SQLiteOpenHelper { // Extract the array of IDs not to get to the string builder. for (long databaseIdLong : exceptIdLongArray) { - if (idsNotToGetStringBuilder.length() == 0) { // This is the first number, so only add the number. - idsNotToGetStringBuilder.append(databaseIdLong); - } else { // This is not the first number, so place a `,` before the new number. + // Check to see if there is already a number in the builder. + if (idsNotToGetStringBuilder.length() > 0) { + // This is not the first number, so place a `,` before the new number. idsNotToGetStringBuilder.append(","); - idsNotToGetStringBuilder.append(databaseIdLong); } + + // Add the new number to the builder. + idsNotToGetStringBuilder.append(databaseIdLong); } // Prepare the SQL statement to select all items except those with the specified IDs. @@ -360,12 +362,14 @@ public class BookmarksDatabaseHelper extends SQLiteOpenHelper { // Extract the array of IDs not to get to the string builder. for (long databaseIdLong : exceptIdLongArray) { - if (idsNotToGetStringBuilder.length() == 0) { // This is the first number, so only add the number. - idsNotToGetStringBuilder.append(databaseIdLong); - } else { // This is not the first number, so place a `,` before the new number. + // Check to see if there is already a number in the builder. + if (idsNotToGetStringBuilder.length() > 0) { + // This is not the first number, so place a `,` before the new number. idsNotToGetStringBuilder.append(","); - idsNotToGetStringBuilder.append(databaseIdLong); } + + // Add the new number to the builder. + idsNotToGetStringBuilder.append(databaseIdLong); } // Prepare the SQL statement to select all items except those with the specified IDs. @@ -436,12 +440,14 @@ public class BookmarksDatabaseHelper extends SQLiteOpenHelper { // Extract the array of IDs not to get to the string builder. for (long databaseIdLong : exceptIdLongArray) { - if (idsNotToGetStringBuilder.length() == 0) { // This is the first number, so only add the number. - idsNotToGetStringBuilder.append(databaseIdLong); - } else { // This is not the first number, so place a `,` before the new number. + // Check to see if there is already a number in the builder. + if (idsNotToGetStringBuilder.length() > 0) { + // This is not the first number, so place a `,` before the new number. idsNotToGetStringBuilder.append(","); - idsNotToGetStringBuilder.append(databaseIdLong); } + + // Add the new number to the builder. + idsNotToGetStringBuilder.append(databaseIdLong); } // SQL escape the folder name. @@ -466,12 +472,14 @@ public class BookmarksDatabaseHelper extends SQLiteOpenHelper { // Extract the array of IDs not to get to the string builder. for (long databaseIdLong : exceptIdLongArray) { - if (idsNotToGetStringBuilder.length() == 0) { // This is the first number, so only add the number. - idsNotToGetStringBuilder.append(databaseIdLong); - } else { // This is not the first number, so place a `,` before the new number. + // Check to see if there is already a number in the builder. + if (idsNotToGetStringBuilder.length() > 0) { + // This is not the first number, so place a `,` before the new number. idsNotToGetStringBuilder.append(","); - idsNotToGetStringBuilder.append(databaseIdLong); } + + // Add the new number to the builder. + idsNotToGetStringBuilder.append(databaseIdLong); } // SQL escape `folderName`.