Bug 1262811 - Remove unnecessary Switchboard logging. r=sebastian
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Thu, 07 Apr 2016 11:08:19 -0400
changeset 348531 c72c4adf49121c74257da7e91e4deb9a90363427
parent 348530 3175145264a4e673ac80f04efab24aee9c69043b
child 348535 010f31417a5ed8c18299d38a91a104f35bd1a30c
child 348542 619d064de7428596f5cd4c4f0152b2813586c7bf
child 348650 96872b962912c1e24a4771f9adc2f8fe407501be
child 348711 c07f0b0d923aecb5299430a2f8c735edfcbaa871
push id14833
push usermleibovic@mozilla.com
push dateThu, 07 Apr 2016 15:09:43 +0000
reviewerssebastian
bugs1262811
milestone48.0a1
Bug 1262811 - Remove unnecessary Switchboard logging. r=sebastian MozReview-Commit-ID: 7y25PagX9E1
mobile/android/thirdparty/com/keepsafe/switchboard/SwitchBoard.java
--- a/mobile/android/thirdparty/com/keepsafe/switchboard/SwitchBoard.java
+++ b/mobile/android/thirdparty/com/keepsafe/switchboard/SwitchBoard.java
@@ -180,21 +180,21 @@ public class SwitchBoard {
         final String config = Preferences.getDynamicConfigJson(c);
 
         if (config == null) {
             return false;
         }
 
         try {
             final JSONObject experiment = new JSONObject(config).getJSONObject(experimentName);
-            if(DEBUG) Log.d(TAG, "experiment " + experimentName + " JSON object: " + experiment.toString());
-
             return experiment != null && experiment.getBoolean(IS_EXPERIMENT_ACTIVE);
         } catch (JSONException e) {
-            Log.e(TAG, "Error getting experiment from config", e);
+            // If the experiment name is not found in the JSON, just return false.
+            // There is no need to log an error, since we don't really care if an
+            // inactive experiment is missing from the config.
             return false;
         }
     }
 
     /**
      * @returns a list of all active experiments.
      */
     public static List<String> getActiveExperiments(Context c) {
@@ -258,36 +258,31 @@ public class SwitchBoard {
     }
 
     /**
      * Returns a String containing the server response from a GET request
      * @param url URL for GET request.
      * @return Returns String from server or null when failed.
      */
     @Nullable private static String readFromUrlGET(URL url) {
-        if (DEBUG) Log.d(TAG, "readFromUrl(): " + url);
-
         try {
             HttpURLConnection connection = (HttpURLConnection) url.openConnection();
             connection.setRequestMethod("GET");
             connection.setUseCaches(false);
 
             InputStream is = connection.getInputStream();
             InputStreamReader inputStreamReader = new InputStreamReader(is);
             BufferedReader bufferReader = new BufferedReader(inputStreamReader, 8192);
-            String line = "";
+            String line;
             StringBuilder resultContent = new StringBuilder();
             while ((line = bufferReader.readLine()) != null) {
-                if(DEBUG) Log.d(TAG, line);
                 resultContent.append(line);
             }
             bufferReader.close();
 
-            if(DEBUG) Log.d(TAG, "readFromUrl() result: " + resultContent.toString());
-
             return resultContent.toString();
         } catch (IOException e) {
             e.printStackTrace();
         }
 
         return null;
     }