Bug 953993. a=lsblakk
authorRichard Newman <rnewman@mozilla.com>
Fri, 03 Jan 2014 14:48:28 -0800
changeset 175559 fe438b8e6dc59ec93239a8f964b5a5b648f09e2e
parent 175558 c255d955ea6cf6c71f1ed928a350958d010420b8
child 175560 7c7908ea653f82a97b52dabb0ed08847deedb09d
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsblakk
bugs953993
milestone28.0a2
Bug 953993. a=lsblakk
mobile/android/base/GeckoProfile.java
--- a/mobile/android/base/GeckoProfile.java
+++ b/mobile/android/base/GeckoProfile.java
@@ -133,16 +133,19 @@ public final class GeckoProfile {
     private static File getMozillaDirectory(Context context) {
         return new File(context.getFilesDir(), MOZILLA_DIR_NAME);
     }
 
     private synchronized File ensureMozillaDirectory() throws IOException {
         if (sMozillaDir.exists() || sMozillaDir.mkdirs()) {
             return sMozillaDir;
         }
+
+        // Although this leaks a path to the system log, the path is
+        // predictable (unlike a profile directory), so this is fine.
         throw new IOException("Unable to create mozilla directory at " + sMozillaDir.getAbsolutePath());
     }
 
     public static boolean removeProfile(Context context, String profileName) {
         return new GeckoProfile(context, profileName).remove();
     }
 
     public static GeckoProfile createGuestProfile(Context context) {
@@ -299,17 +302,17 @@ public final class GeckoProfile {
     public boolean inGuestMode() {
         return mInGuestMode;
     }
 
     private void setDir(File dir) {
         if (dir != null && dir.exists() && dir.isDirectory()) {
             mProfileDir = dir;
         } else {
-            Log.w(LOGTAG, "requested profile directory missing: " + dir);
+            Log.w(LOGTAG, "Requested profile directory missing.");
         }
     }
 
     public String getName() {
         return mName;
     }
 
     public synchronized File getDir() {
@@ -325,17 +328,17 @@ public final class GeckoProfile {
         try {
             // Check if a profile with this name already exists.
             File mozillaDir = ensureMozillaDirectory();
             mProfileDir = findProfileDir(mozillaDir);
             if (mProfileDir == null) {
                 // otherwise create it
                 mProfileDir = createProfileDir(mozillaDir);
             } else {
-                Log.d(LOGTAG, "Found profile dir: " + mProfileDir.getAbsolutePath());
+                Log.d(LOGTAG, "Found profile dir.");
             }
         } catch (IOException ioe) {
             Log.e(LOGTAG, "Error getting profile dir", ioe);
         }
         return this;
     }
 
     public File getFile(String aFile) {
@@ -462,17 +465,17 @@ public final class GeckoProfile {
                     parser.removeSection(mName);
                     return true;
                 }
             }
 
             parser.write();
             return true;
         } catch (IOException ex) {
-            Log.w(LOGTAG, "Failed to remove profile " + mName + ":\n" + ex);
+            Log.w(LOGTAG, "Failed to remove profile.", ex);
             return false;
         }
     }
 
     public static String findDefaultProfile(Context context) {
         // Have we read the default profile from the INI already?
         // Changing the default profile requires a restart, so we don't
         // need to worry about runtime changes.
@@ -530,20 +533,20 @@ public final class GeckoProfile {
         String saltedName = saltProfileName(mName);
         File profileDir = new File(mozillaDir, saltedName);
         while (profileDir.exists()) {
             saltedName = saltProfileName(mName);
             profileDir = new File(mozillaDir, saltedName);
         }
 
         // Attempt to create the salted profile dir
-        if (! profileDir.mkdirs()) {
-            throw new IOException("Unable to create profile at " + profileDir.getAbsolutePath());
+        if (!profileDir.mkdirs()) {
+            throw new IOException("Unable to create profile.");
         }
-        Log.d(LOGTAG, "Created new profile dir at " + profileDir.getAbsolutePath());
+        Log.d(LOGTAG, "Created new profile dir.");
 
         // Now update profiles.ini
         // If this is the first time its created, we also add a General section
         // look for the first profile number that isn't taken yet
         int profileNum = 0;
         while (parser.getSection("Profile" + profileNum) != null) {
             profileNum++;
         }