Dbrant has submitted this change and it was merged.

Change subject: Codestyle: Category Coding (some Utils)
......................................................................


Codestyle: Category Coding (some Utils)

Change-Id: Ie97e173f374d7a173e485adfb5e92b904ee1ab44
---
M wikipedia/src/main/java/org/wikipedia/Utils.java
1 file changed, 7 insertions(+), 3 deletions(-)

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



diff --git a/wikipedia/src/main/java/org/wikipedia/Utils.java 
b/wikipedia/src/main/java/org/wikipedia/Utils.java
index 0ffa8fd..65b5425 100644
--- a/wikipedia/src/main/java/org/wikipedia/Utils.java
+++ b/wikipedia/src/main/java/org/wikipedia/Utils.java
@@ -57,6 +57,10 @@
  * Contains utility methods that Java doesn't have because we can't make code 
look too good, can we?
  */
 public final class Utils {
+
+    private static final int MCC_LENGTH = 3;
+    private static final int KB16 = 16 * 1024;
+
     /**
      * Private constructor, so nobody can construct Utils.
      *
@@ -279,7 +283,7 @@
                 if (t != null && t.getPhoneType() >= 0) {
                     mccMncNetwork = t.getNetworkOperator();
                     if (mccMncNetwork != null) {
-                        mccMncNetwork = mccMncNetwork.substring(0, 3) + "-" + 
mccMncNetwork.substring(3);
+                        mccMncNetwork = mccMncNetwork.substring(0, MCC_LENGTH) 
+ "-" + mccMncNetwork.substring(MCC_LENGTH);
                     } else {
                         mccMncNetwork = "000-00";
                     }
@@ -289,7 +293,7 @@
                     // so let's check the SIM, too. Let's not worry if it's 
CDMA, as the def of CDMA is complex.
                     mccMncSim = t.getSimOperator();
                     if (mccMncSim != null) {
-                        mccMncSim = mccMncSim.substring(0, 3) + "-" + 
mccMncSim.substring(3);
+                        mccMncSim = mccMncSim.substring(0, MCC_LENGTH) + "-" + 
mccMncSim.substring(MCC_LENGTH);
                     } else {
                         mccMncSim = "000-00";
                     }
@@ -474,7 +478,7 @@
      * @throws IOException
      */
     public static void copyStreams(InputStream in, OutputStream out) throws 
IOException {
-        byte[] buffer = new byte[16 * 1024]; // 16kb buffer
+        byte[] buffer = new byte[KB16]; // 16kb buffer
         int len;
         while ((len = in.read(buffer)) != -1) {
             out.write(buffer, 0, len);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie97e173f374d7a173e485adfb5e92b904ee1ab44
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND <bsitzm...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: Yuvipanda <yuvipa...@gmail.com>
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