commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (DBCP-446) NullPointerException thrown when calling ManagedConnection.isClosed()
Date Thu, 21 Jul 2016 03:57:20 GMT

     [ https://issues.apache.org/jira/browse/DBCP-446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gary Gregory resolved DBCP-446.
-------------------------------
       Resolution: Fixed
    Fix Version/s: 2.2

The fix I made is:

{code:java}
    @Override
    public boolean isClosed() throws SQLException {
        return _closed || _conn == null || _conn.isClosed();
    }
{code}

> NullPointerException thrown when calling ManagedConnection.isClosed()
> ---------------------------------------------------------------------
>
>                 Key: DBCP-446
>                 URL: https://issues.apache.org/jira/browse/DBCP-446
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.4, 2.1.1
>            Reporter: feng yang
>            Priority: Critical
>             Fix For: 2.2
>
>
> Hello all,
> I'm using commons-dbcp 1.4, and I found this exception. I don't if it's reported already
before, I have done some searches in google, but nothing found. 
> Here is the call stack.
> 2015-08-18 15:01:50,091 [Thread-49] console : ERROR -   ... 44 more
> 2015-08-18 16:04:57,963 [Thread-45] console : ERROR - java.lang.NullPointerException
> 2015-08-18 16:04:57,965 [Thread-45] console : ERROR -   at org.apache.commons.dbcp.DelegatingConnection.isClosed(DelegatingConnection.java:386)
> 2015-08-18 16:04:57,965 [Thread-45] console : ERROR -   at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.releaseConnection(LogicalConnectionImpl.java:237)
> 2015-08-18 16:04:57,965 [Thread-45] console : ERROR -   at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.aggressiveRelease(LogicalConnectionImpl.java:200)
> 2015-08-18 16:04:57,965 [Thread-45] console : ERROR -   at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.afterTransaction(JdbcCoordinatorImpl.java:272)
> 2015-08-18 16:04:57,965 [Thread-45] console : ERROR -   at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.afterTransaction(TransactionCoordinatorImpl.java:144)
> 2015-08-18 16:04:57,965 [Thread-45] console : ERROR -   at org.hibernate.engine.transaction.internal.jta.JtaTransaction.afterAfterCompletion(JtaTransaction.java:179)
> 2015-08-18 16:04:57,966 [Thread-45] console : ERROR -   at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.rollback(AbstractTransactionImpl.java:219)
> So when I debugged it, it created a ManagedConnection, which is a sub-class of DelegatingConnection,
and the _conn is initialized with null, and the _closed is false by default. So when hibernate
calls the isClosed(), it throws a nullpointer exception.
> Could you guys tell me if in your side, or the hibernate side ?
> Do not hesitate to contact me if you need more information.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message