You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2013/05/13 22:04:43 UTC

svn commit: r1482055 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: config/EntityConfigUtil.java connection/DBCPConnectionFactory.java

Author: doogie
Date: Mon May 13 20:04:43 2013
New Revision: 1482055

URL: http://svn.apache.org/r1482055
Log:
OPTIMIZE: Move the fetching of the jdbc-password attribute into a single
global static method.  Soon, this logic will be changed to support
looking the password up in an external file, so that security can be
imported.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java?rev=1482055&r1=1482054&r2=1482055&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/EntityConfigUtil.java Mon May 13 20:04:43 2013
@@ -249,4 +249,8 @@ public class EntityConfigUtil {
     public static Map<String, DatasourceInfo> getDatasourceInfos() {
         return configRef.get().datasourceInfos;
     }
+
+    public static String getJdbcPassword(Element inlineJdbcElement) {
+        return inlineJdbcElement.getAttribute("jdbc-password");
+    }
 }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=1482055&r1=1482054&r2=1482055&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Mon May 13 20:04:43 2013
@@ -39,6 +39,7 @@ import org.apache.commons.pool.impl.Gene
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.datasource.GenericHelperInfo;
 import org.ofbiz.entity.transaction.TransactionFactory;
 import org.w3c.dom.Element;
@@ -63,7 +64,7 @@ public class DBCPConnectionFactory imple
 
         String jdbcUri = UtilValidate.isNotEmpty(helperInfo.getOverrideJdbcUri()) ? helperInfo.getOverrideJdbcUri() : jdbcElement.getAttribute("jdbc-uri");
         String jdbcUsername = UtilValidate.isNotEmpty(helperInfo.getOverrideUsername()) ? helperInfo.getOverrideUsername() : jdbcElement.getAttribute("jdbc-username");
-        String jdbcPassword = UtilValidate.isNotEmpty(helperInfo.getOverridePassword()) ? helperInfo.getOverridePassword() : jdbcElement.getAttribute("jdbc-password");
+        String jdbcPassword = UtilValidate.isNotEmpty(helperInfo.getOverridePassword()) ? helperInfo.getOverridePassword() : EntityConfigUtil.getJdbcPassword(jdbcElement);
 
         // pool settings
         int maxSize, minSize, timeBetweenEvictionRunsMillis;