details: https://code.openbravo.com/erp/devel/pi/rev/4cf8d54ecd9b
changeset: 17741:4cf8d54ecd9b
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Wed Aug 22 11:26:21 2012 +0200
summary: Fixed issue 21125. PreparedStatement wasn't being closed.
diffstat:
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
| 32 +++++----
1 files changed, 18 insertions(+), 14 deletions(-)
diffs (43 lines):
diff -r 8a09d93b4149 -r 4cf8d54ecd9b
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
Wed Aug 22 11:03:59 2012 +0200
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
Wed Aug 22 11:26:21 2012 +0200
@@ -1578,21 +1578,25 @@
log.debug("Transformed SQL code: " + sql);
int indP = 1;
PreparedStatement ps =
OBDal.getInstance().getConnection(false).prepareStatement(sql);
- for (String parameter : params) {
- String value = "";
- if (parameter.substring(0, 1).equals("#")) {
- value = Utility.getContext(new DalConnectionProvider(false),
RequestContext.get()
- .getVariablesSecureApp(), parameter, windowId);
- } else {
- String fieldId = "inp" + Sqlc.TransformaNombreColumna(parameter);
- value = RequestContext.get().getRequestParameter(fieldId);
+ try {
+ for (String parameter : params) {
+ String value = "";
+ if (parameter.substring(0, 1).equals("#")) {
+ value = Utility.getContext(new DalConnectionProvider(false),
RequestContext.get()
+ .getVariablesSecureApp(), parameter, windowId);
+ } else {
+ String fieldId = "inp" + Sqlc.TransformaNombreColumna(parameter);
+ value = RequestContext.get().getRequestParameter(fieldId);
+ }
+ log.debug("Parameter: " + parameter + ": Value " + value);
+ ps.setObject(indP++, value);
}
- log.debug("Parameter: " + parameter + ": Value " + value);
- ps.setObject(indP++, value);
- }
- ResultSet rs = ps.executeQuery();
- if (rs.next()) {
- fvalue = rs.getObject(1);
+ ResultSet rs = ps.executeQuery();
+ if (rs.next()) {
+ fvalue = rs.getObject(1);
+ }
+ } finally {
+ ps.close();
}
} else if (code.startsWith("@")) {
String codeWithoutAt = code.substring(1, code.length() - 1);
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits