jenkins-bot has submitted this change and it was merged.

Change subject: Don't lazy-init db column indices.
......................................................................


Don't lazy-init db column indices.

Column indices can vary between different tables.
In a subsequent patch, we can lazy-init the indices on a per-table basis.
In the meantime, this fixes the current bug. Fortunately, there's no issue
with the integrity of our db itself.

Bug: T130086
Change-Id: Ied03ebdbe6986217b2838d82a6fdfc0d03b5baba
---
M app/src/main/java/org/wikipedia/database/column/Column.java
1 file changed, 1 insertion(+), 6 deletions(-)

Approvals:
  Niedzielski: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/app/src/main/java/org/wikipedia/database/column/Column.java 
b/app/src/main/java/org/wikipedia/database/column/Column.java
index 20bd14b..ec459a3 100644
--- a/app/src/main/java/org/wikipedia/database/column/Column.java
+++ b/app/src/main/java/org/wikipedia/database/column/Column.java
@@ -2,12 +2,10 @@
 
 import android.database.Cursor;
 import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
 
 public abstract class Column<T> {
     @NonNull private final String name;
     @NonNull private final String type;
-    @Nullable private Integer index;
 
     /**
      * @param name Column name.
@@ -48,9 +46,6 @@
     }
 
     protected int getIndex(@NonNull Cursor cursor) {
-        if (index == null) {
-            index = cursor.getColumnIndexOrThrow(getName());
-        }
-        return index;
+        return cursor.getColumnIndexOrThrow(getName());
     }
 }
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/277708
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ied03ebdbe6986217b2838d82a6fdfc0d03b5baba
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>
Gerrit-Reviewer: BearND <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Dbrant <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to