geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanhongf...@apache.org
Subject svn commit: r1153036 - /geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
Date Tue, 02 Aug 2011 06:12:58 GMT
Author: hanhongfang
Date: Tue Aug  2 06:12:58 2011
New Revision: 1153036

URL: http://svn.apache.org/viewvc?rev=1153036&view=rev
Log:
revert rev1153013.

Modified:
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=1153036&r1=1153035&r2=1153036&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
Tue Aug  2 06:12:58 2011
@@ -24,14 +24,10 @@ import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -676,24 +672,10 @@ public class LocalAttributeManager imple
     private static void storeConfigSubstitutions(File configSubstitutionsFile, Properties
properties) {
         if (configSubstitutionsFile != null) {
             try {
-                OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(configSubstitutionsFile),
-                        "ISO-8859-1");
+                FileOutputStream out = new FileOutputStream(configSubstitutionsFile);
                 try {
-                    out.write(new String(INSTRUCTION));
-                    out.write("#" + (new Date()).toString() + "\n");
-                    
-                    ArrayList<String> keys2 = new ArrayList(properties.keySet());
-                    Collections.sort(keys2, new Comparator<String>() {
-                        public int compare(String o1, String o2) {
-                            return o1.toLowerCase().compareTo(o2.toLowerCase());
-                        }
-                    });
-                    for (Object o : keys2) {
-                        String key = (String) o;
-                        String value = properties.getProperty(key);
-                        out.write(processProperty(key, true) + "=" + processProperty(value,
false) + "\n");
-                    }
-                    out.flush();
+                    out.write(INSTRUCTION);                    
+                    properties.store(out, null);
                 } finally {
                     out.close();
                 }
@@ -703,17 +685,6 @@ public class LocalAttributeManager imple
         }
     }
 
-    // process the value and element of property as what java.util.Properties.store(Writer
writer, String comments) does
-    private static String processProperty(String str, boolean isKey) {
-        boolean hasLeadingSpace = str.startsWith(" ");
-        String temp0 = isKey ? str.replaceAll(" ", "\\\\ ") : (hasLeadingSpace ? str.replaceFirst("
", "\\\\ ") : str);
-        String temp1 = temp0.replaceAll("!", "\\\\!");
-        String temp2 = temp1.replaceAll("#", "\\\\#");
-        String temp3 = temp2.replaceAll(":", "\\\\:");
-        String temp4 = temp3.replaceAll("=", "\\\\=");
-        return temp4;
-    }
-    
     private static void addGeronimoSubstitutions(Map<String, Object> vars, Map props,
String prefix) {
         if (prefix != null) {
             int start = prefix.length();



Mime
View raw message