You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/11/04 18:03:44 UTC
DO NOT REPLY [Bug 37359] New: -
[PATCH] SharedPoolDataSource - close() method closes pool instance only when pool available (initialized)
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37359>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=37359
Summary: [PATCH] SharedPoolDataSource - close() method closes
pool instance only when pool available (initialized)
Product: Commons
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: trivial
Priority: P3
Component: Dbcp
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: vimr@hsf.cz
When SharedPoolDataSource is created and never initialized by call to
registerPool(String, String) method (called by getPooledConnectionAndInfo()
method , so no connection is requested from any caller), and the method close()
is called, the NullPointerException raises like this:
2005-11-04 16:24:15,990 [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
ERROR org.apache.torque.dsfactory.SharedPoolDataSourceFactory - Exception caught
during close()
java.lang.NullPointerException
at
org.apache.commons.dbcp.datasources.SharedPoolDataSource.close(SharedPoolDataSource.java:64)
at
org.apache.torque.dsfactory.SharedPoolDataSourceFactory.close(SharedPoolDataSourceFactory.java:111)
at org.apache.torque.TorqueInstance.shutdown(TorqueInstance.java:575)
at org.apache.torque.avalon.TorqueComponent.stop(TorqueComponent.java:188)
at
org.apache.avalon.framework.container.ContainerUtil.stop(ContainerUtil.java:314)
at
org.apache.avalon.excalibur.component.DefaultComponentFactory.decommission(DefaultComponentFactory.java:381)
at
org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.dispose(ThreadSafeComponentHandler.java:198)
at
org.apache.avalon.excalibur.component.ExcaliburComponentManager.dispose(ExcaliburComponentManager.java:654)
at
org.apache.turbine.services.avaloncomponent.TurbineAvalonComponentService.dispose(TurbineAvalonComponentService.java:204)
at
org.apache.turbine.services.avaloncomponent.TurbineAvalonComponentService.shutdown(TurbineAvalonComponentService.java:115)
at
org.apache.turbine.services.BaseServiceBroker.shutdownService(BaseServiceBroker.java:383)
at
org.apache.turbine.services.BaseServiceBroker.shutdownServices(BaseServiceBroker.java:429)
at org.apache.turbine.Turbine.destroy(Turbine.java:628)
PooledConnection
(output from logs of apache turbine, when the turbine application is deployed to
tomcat and then re-deployed ).
To fix this, there is a patch:
getPooledConnectionvimr@bene2:/var/data/src/java/commons-dbcp-cvs/jakarta-commons>
cvs diff -u
dbcp/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
Index: dbcp/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java,v
retrieving revision 1.10
diff -u -r1.10 SharedPoolDataSource.java
--- dbcp/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
20 Oct 2004 20:46:30 -0000 1.10
+++ dbcp/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java
4 Nov 2005 15:37:24 -0000
@@ -61,7 +61,10 @@
* Close pool being maintained by this datasource.
*/
public void close() throws Exception {
- pool.close();
+
+ if(pool != null)
+ pool.close();
+
InstanceKeyObjectFactory.removeInstance(instanceKey);
}
Jindrich Vimr
<vi...@hsf.cz>
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org