Bug 991394 - Actually rename profiles.ini sections when removing profile. r=mfinkle, a=lsblakk
authorMyk Melez <myk@mozilla.org>
Wed, 21 May 2014 08:12:51 -0700
changeset 192362 eac674ed7cfe
parent 192361 af6bb6bacb0e
child 192363 0bcc74404878
push id3583
push userryanvm@gmail.com
push date2014-05-22 12:45 +0000
Treeherderresults
reviewersmfinkle, lsblakk
bugs991394
milestone30.0
Bug 991394 - Actually rename profiles.ini sections when removing profile. r=mfinkle, a=lsblakk
mobile/android/base/GeckoProfile.java
mobile/android/base/util/INIParser.java
mobile/android/base/util/INISection.java
--- a/mobile/android/base/GeckoProfile.java
+++ b/mobile/android/base/GeckoProfile.java
@@ -465,18 +465,19 @@ public final class GeckoProfile {
                     } catch (NumberFormatException nex) {
                         // uhm, malformed Profile thing; we can't do much.
                         Log.e(LOGTAG, "Malformed section name in profiles.ini: " + section.getName());
                         return false;
                     }
                 } else {
                     // this really shouldn't be the case, but handle it anyway
                     parser.removeSection(mName);
-                    return true;
                 }
+
+                break;
             }
 
             parser.write();
             return true;
         } catch (IOException ex) {
             Log.w(LOGTAG, "Failed to remove profile.", ex);
             return false;
         }
--- a/mobile/android/base/util/INIParser.java
+++ b/mobile/android/base/util/INIParser.java
@@ -164,12 +164,13 @@ public final class INIParser extends INI
         // ensure that we have parsed the file
         getSections();
 
         mSections.remove(newName);
         INISection section = mSections.get(oldName);
         if (section == null)
             return;
 
+        section.setName(newName);
         mSections.remove(oldName);
         mSections.put(newName, section);
     }
 }
--- a/mobile/android/base/util/INISection.java
+++ b/mobile/android/base/util/INISection.java
@@ -13,16 +13,17 @@ import java.util.Enumeration;
 import java.util.Hashtable;
 
 public class INISection {
     private static final String LOGTAG = "INIParser";
 
     // default file to read and write to
     private String mName = null;
     public String getName() { return mName; }
+    public void setName(String name) { mName = name; }
 
     // show or hide debug logging
     private  boolean mDebug = false;
 
     // Global properties that aren't inside a section in the file
     protected Hashtable<String, Object> mProperties = null;
 
     // create a parser. The file will not be read until you attempt to