Author: chathura
Date: Thu Jan 17 22:05:29 2008
New Revision: 12448
Log:
Fixed a bug in SQL query processor.
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
Thu Jan 17 22:05:29 2008
@@ -49,11 +49,13 @@
public Resource executeQuery(Resource query, Map parameters)
throws RegistryException {
+ Connection conn = null;
+
try {
String sqlString = (String)query.getContent();
- Connection conn = dataSource.getConnection();
+ conn = dataSource.getConnection();
PreparedStatement s = conn.prepareStatement(sqlString);
if (parameters != null) {
@@ -114,6 +116,15 @@
} catch (SQLException e) {
throw new RegistryException(e.getMessage());
+
+ } finally {
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (SQLException ignore) {
+
+ }
+ }
}
}
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev