Index: org/apache/beehive/controls/system/jdbc/JdbcControlImpl.jcs =================================================================== --- org/apache/beehive/controls/system/jdbc/JdbcControlImpl.jcs (revision 193000) +++ org/apache/beehive/controls/system/jdbc/JdbcControlImpl.jcs (working copy) @@ -65,8 +65,8 @@ protected transient DataSource _dataSource; protected transient ConnectionDriver _connectionDriver; - private transient Calendar _cal; - private transient Vector _resources = new Vector(); + private Calendar _cal; + private transient Vector _resources; private static final String EMPTY_STRING = ""; private static final Logger logger = Logger.getLogger(JdbcControlImpl.class); @@ -123,13 +123,13 @@ logger.debug("Enter: onRelease()"); } - for (PreparedStatement ps : _resources) { + for (PreparedStatement ps : getResources()) { try { ps.close(); } catch (SQLException sqe) { } } - _resources.clear(); + getResources().clear(); if (_connection != null) { try { @@ -364,7 +364,7 @@ returnObject = rsm.mapToResultType(_context, method, rs, _cal); if (rsm.canCloseResultSet() == false) { - _resources.add(ps); + getResources().add(ps); } // @@ -383,7 +383,7 @@ } finally { // Keep statements open that have in-use result sets - if (ps != null && !_resources.contains(ps)) { + if (ps != null && !getResources().contains(ps)) { ps.close(); } } @@ -456,6 +456,17 @@ } /** + * Get the Vector of Statements which we need to keep open. + * @return Vector of PreparedStatement + */ + private Vector getResources() { + if (_resources == null) { + _resources = new Vector(); + } + return _resources; + } + + /** * Parse the propertiesString into a Properties object. The string must have the format of: * propertyName=propertyValue;propertyName=propertyValue;... *