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

Change subject: Hygiene: make CardPageItem.namespace nonnull
......................................................................


Hygiene: make CardPageItem.namespace nonnull

Make CardPageItem.namespace @NonNull by adding default Namespace.MAIN
value when JSON field is not present.

Change-Id: I462d1e0fbee4efe1ec6d386b91ce1f43aabde457
---
M app/src/main/java/org/wikipedia/feed/model/CardPageItem.java
M app/src/main/java/org/wikipedia/random/RandomSummaryService.java
2 files changed, 3 insertions(+), 4 deletions(-)

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



diff --git a/app/src/main/java/org/wikipedia/feed/model/CardPageItem.java 
b/app/src/main/java/org/wikipedia/feed/model/CardPageItem.java
index 7a3e0b6..bd5b9f8 100644
--- a/app/src/main/java/org/wikipedia/feed/model/CardPageItem.java
+++ b/app/src/main/java/org/wikipedia/feed/model/CardPageItem.java
@@ -16,7 +16,7 @@
     @SuppressWarnings("unused") @Nullable private Thumbnail thumbnail;
     @SuppressWarnings("unused") @Nullable private String description;
     @SuppressWarnings("unused") @Nullable private String extract;
-    @SuppressWarnings("unused") @Nullable 
@JsonAdapter(NamespaceTypeAdapter.class) private Namespace namespace;
+    @SuppressWarnings("unused") @NonNull 
@JsonAdapter(NamespaceTypeAdapter.class) private Namespace namespace = 
Namespace.MAIN;
 
     @NonNull
     public String title() {
@@ -39,7 +39,7 @@
         return extract == null ? null : StringUtil.sanitizeText(extract);
     }
 
-    @Nullable
+    @NonNull
     public Namespace namespace() {
         return namespace;
     }
diff --git a/app/src/main/java/org/wikipedia/random/RandomSummaryService.java 
b/app/src/main/java/org/wikipedia/random/RandomSummaryService.java
index 18e6556..3350cd3 100644
--- a/app/src/main/java/org/wikipedia/random/RandomSummaryService.java
+++ b/app/src/main/java/org/wikipedia/random/RandomSummaryService.java
@@ -39,8 +39,7 @@
                 if (response.isSuccessful()) {
                     responseHeaderHandler.onHeaderCheck(response);
                     CardPageItem item = response.body();
-                    String namespace = item.namespace() == null ? null
-                            : item.namespace().toLegacyString();
+                    String namespace = item.namespace().toLegacyString();
                     PageTitle title = new PageTitle(namespace, item.title(), 
site);
                     cb.onSuccess(title);
                 } else {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I462d1e0fbee4efe1ec6d386b91ce1f43aabde457
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: BearND <bsitzm...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to