ozeigermann 2004/11/22 08:31:46
Modified: src/stores/org/apache/slide/store/impl/rdbms Tag:
SLIDE_2_1_RELEASE_BRANCH AbstractRDBMSStore.java
Log:
Fixed hazard of unclosed connection when an error occurs while retrieving
content
Revision Changes Path
No revision
No revision
1.10.2.2 +17 -11
jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/AbstractRDBMSStore.java
Index: AbstractRDBMSStore.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/AbstractRDBMSStore.java,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -u -r1.10.2.1 -r1.10.2.2
--- AbstractRDBMSStore.java 30 Oct 2004 21:47:25 -0000 1.10.2.1
+++ AbstractRDBMSStore.java 22 Nov 2004 16:31:45 -0000 1.10.2.2
@@ -787,18 +787,24 @@
connection = getNewConnection();
return adapter.retrieveRevisionContent(connection, uri,
revisionDescriptor, true);
} catch (SQLException e) {
- throw new ServiceAccessException(this, e);
- } finally {
+ // only close connection in case of error as standard closing
// will be done in adapter or upon closing of stream
- /*
if (connection != null) {
try {
- connection.close();
- } catch (SQLException e) {
- getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
+ if (!tmCommits) {
+ connection.commit();
+ }
+ } catch (SQLException e2) {
+ throw new ServiceAccessException(this, e2);
+ } finally {
+ try {
+ connection.close();
+ } catch (SQLException e2) {
+ getLogger().log(e2, LOG_CHANNEL, Logger.WARNING);
+ }
}
}
- */
+ throw new ServiceAccessException(this, e);
}
} else {
return adapter.retrieveRevisionContent(getCurrentConnection(),
uri, revisionDescriptor, false);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]