geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashishj...@apache.org
Subject svn commit: r1036008 - /geronimo/server/branches/2.1/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/MapEditor.java
Date Wed, 17 Nov 2010 12:43:29 GMT
Author: ashishjain
Date: Wed Nov 17 12:43:28 2010
New Revision: 1036008

URL: http://svn.apache.org/viewvc?rev=1036008&view=rev
Log:
GERONIMO-5693 Fix for 2.1

Modified:
    geronimo/server/branches/2.1/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/MapEditor.java

Modified: geronimo/server/branches/2.1/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/MapEditor.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/MapEditor.java?rev=1036008&r1=1036007&r2=1036008&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/MapEditor.java
(original)
+++ geronimo/server/branches/2.1/framework/modules/geronimo-common/src/main/java/org/apache/geronimo/common/propertyeditor/MapEditor.java
Wed Nov 17 12:43:28 2010
@@ -25,6 +25,7 @@ import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.crypto.EncryptionManager;
 
 /**
  * A property editor for {@link java.util.Map}.
@@ -44,7 +45,15 @@ public class MapEditor
             ByteArrayInputStream is = new ByteArrayInputStream(text == null? new byte[0]:
text.getBytes());
             Properties p = new Properties();
             p.load(is);
-            
+            Iterator it=p.keySet().iterator();
+            while(it.hasNext()){
+                String key=it.next().toString();
+                if(key.endsWith("Password")||key.endsWith("password")){
+                  String encryptedValue=(String)p.get(key);
+                  String decryptedValue=(String)EncryptionManager.decrypt(encryptedValue);
+                  p.put(key, decryptedValue);
+                }
+            }
             setValue((Map)p);
         } catch (IOException e) {
             throw new PropertyEditorException(e.getMessage(), e);
@@ -74,6 +83,15 @@ public class MapEditor
                         p.put(key, value);
                     }
                 }
+                Iterator it=p.keySet().iterator();
+                while(it.hasNext()){
+                    String key=it.next().toString();
+                    if(key.endsWith("Password")||key.endsWith("password")){
+                      String value=(String)p.get(key);
+                      String encryptedValue=EncryptionManager.encrypt(value);
+                      p.put(key, encryptedValue);
+                    }
+                }
                 map = p;
             }
         }



Mime
View raw message