details: https://code.openbravo.com/erp/devel/pi/rev/b6e9ed3c0a97
changeset: 18602:b6e9ed3c0a97
user: Ioritz Cia <ioritz.cia <at> openbravo.com>
date: Thu Nov 22 12:26:50 2012 +0100
summary: Fixes issue 22372: Not closed PreparedStatment.
diffstat:
src/org/openbravo/dal/xml/EntityResolver.java | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diffs (41 lines):
diff -r d9c62a163d23 -r b6e9ed3c0a97
src/org/openbravo/dal/xml/EntityResolver.java
--- a/src/org/openbravo/dal/xml/EntityResolver.java Thu Nov 22 06:38:59
2012 +0100
+++ b/src/org/openbravo/dal/xml/EntityResolver.java Thu Nov 22 12:26:50
2012 +0100
@@ -24,6 +24,7 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -418,6 +419,7 @@
private List<RefDataLoaded> getRefLoadedsUsingSql(String id, Entity entity,
String orgId,
boolean filterByClient) {
+ PreparedStatement ps = null;
try {
String st = "Select specific_id, generic_id, ad_client_id, ad_org_id
from ad_ref_data_loaded where ad_client_id in ('"
+ client.getId()
@@ -425,7 +427,7 @@
+ id
+ "' and ad_table_id='"
+ entity.getTableId() + "'";
- PreparedStatement ps = new
DalConnectionProvider(false).getPreparedStatement(st);
+ ps = new DalConnectionProvider(false).getPreparedStatement(st);
ps.execute();
ResultSet rs = ps.getResultSet();
List<RefDataLoaded> refDataLoadeds = new
ArrayList<EntityResolver.RefDataLoaded>();
@@ -440,6 +442,12 @@
return refDataLoadeds;
} catch (Exception e) {
throw new OBException("Error while accessing the ad_ref_data_loaded
table", e);
+ } finally {
+ try {
+ ps.close();
+ } catch (SQLException se) {
+ // won't happen
+ }
}
}
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits