|
For evidence that Connection.close() shouldn't throw an exception just because the connection is already closed, see Sun's API spec for the Connction.close() method. http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Connection.html#close(
This is a bug. According to
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#close( "Calling the method close on a Statement object that is already closed has no
Anyone working on this? This has been reported two years ago now, and it's
really a PITA when trying to introduce DBCP for a legacy app. Can this be fixed? It's an obvious violation of the API contract and breaks
legacy applications. Thanks. (In reply to comment #7)
> Can this be fixed? It's an obvious violation of the API contract and breaks > legacy applications. Thanks. Yes, it needs to be fixed. Working on Dbcp is next on my personal todo list, In the existing code's defense the contract for close changed from Java 1.3 to 1.4: See Comment of [Philippe Mouawad] 12/Jul/06 09:19 PM for a problem that occurs if this bug is not corrected.
http://issues.apache.org/jira/browse/DBCP-28 Philippe. Is there anything wrong with Adam Jenkin's patch that was posted nearly 3 years ago now?
This represents a behavior change that may break some existing code, so fix version is set to 1.3.
Shouldn't we at least apply the patch to the trunk so that it appears in our nightlies?
Maybe time to branch 1.2.2 off and have trunk be 1.3?
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There is a junit test that fails if no exception is thrown:
testCantCloseConnectionTwice()
Also the alternative datasource implementation does the same in
org.apache.commons.dbcp.cpdsadapter.ConnectionImpl
I'm marking this issue WONTFIX until more evidence is presented that throwing an
exception is illegal / undesired.