fixes issue 38357: Unused connection pool created on module installation
authorCarlos Aristu <carlos.aristu@openbravo.com>
Thu, 12 Apr 2018 17:04:43 +0200
changeset 33824 1828446d8690
parent 33823 ad75e9315716
child 33825 86538f0c0124
fixes issue 38357: Unused connection pool created on module installation
src/org/openbravo/erpCommon/modules/ImportModule.java
--- a/src/org/openbravo/erpCommon/modules/ImportModule.java	Thu Apr 12 16:28:17 2018 +0200
+++ b/src/org/openbravo/erpCommon/modules/ImportModule.java	Thu Apr 12 17:04:43 2018 +0200
@@ -30,14 +30,12 @@
 import java.net.URL;
 import java.net.URLEncoder;
 import java.rmi.RemoteException;
-import java.sql.Connection;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Properties;
 import java.util.Vector;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
@@ -54,7 +52,6 @@
 
 import org.apache.axis.AxisFault;
 import org.apache.commons.beanutils.DynaBean;
-import org.apache.commons.dbcp.BasicDataSource;
 import org.apache.commons.io.FileUtils;
 import org.apache.ddlutils.io.DataReader;
 import org.apache.ddlutils.io.DataToArraySink;
@@ -1268,21 +1265,6 @@
   private void insertDynaModulesInDB(Vector<DynaBean> dModulesToInstall,
       Vector<DynaBean> dependencies1, Vector<DynaBean> dbPrefix, boolean newModule)
       throws Exception {
-    final Properties obProperties = new Properties();
-    obProperties.load(new FileInputStream(obDir + "/config/Openbravo.properties"));
-
-    final String url = obProperties.getProperty("bbdd.url")
-        + (obProperties.getProperty("bbdd.rdbms").equals("POSTGRE") ? "/"
-            + obProperties.getProperty("bbdd.sid") : "");
-
-    final BasicDataSource ds = new BasicDataSource();
-    ds.setDriverClassName(obProperties.getProperty("bbdd.driver"));
-    ds.setUrl(url);
-    ds.setUsername(obProperties.getProperty("bbdd.user"));
-    ds.setPassword(obProperties.getProperty("bbdd.password"));
-
-    final Connection conn = ds.getConnection();
-
     Integer seqNo = Integer.valueOf(ImportModuleData.selectSeqNo(pool));
 
     for (final DynaBean module : dModulesToInstall) {
@@ -1346,8 +1328,6 @@
           (String) module.get("AD_MODULE_DBPREFIX_ID"), (String) module.get("AD_MODULE_ID"),
           (String) module.get("NAME"));
     }
-
-    conn.close();
   }
 
   /**