Bug 1262811 - Remove unnecessary Switchboard logging. r=sebastian
MozReview-Commit-ID: 7y25PagX9E1
--- 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;
}