Subject NullPointerException in FBManagedConnection#clearWarnings
Author Robert DiFalco
I'm sure I'm doing something wrong but I can't seem to get the correct
version of the JayBird source to investigate. This is using the latest
release (1.01 I think). Here's the stack trace:

java.lang.NullPointerException
at
org.firebirdsql.jca.FBManagedConnection.clearWarnings(FBManagedConnectio
n.java:1044)
at
org.firebirdsql.jdbc.FBConnection.clearIscWarnings(FBConnection.java:108
3)
at
org.firebirdsql.jdbc.FBConnection.clearWarnings(FBConnection.java:753)
at
com.tripwire.space.core.persistence.db.PooledConnection.clearWarnings(Co
nnectionPool.java:585)
at
com.tripwire.space.core.persistence.db.PooledConnection.canReuse(Connect
ionPool.java:556)
at
com.tripwire.space.core.persistence.db.ConnectionPool.release(Connection
Pool.java:358)
at
com.tripwire.space.core.persistence.db.DatabaseTransaction.doCommit(Data
baseTransaction.java:89)
at
com.tripwire.space.core.persistence.Transaction.commit(Transaction.java:
178)
at
com.tripwire.space.ui.web.app.RequestContext.commitReadOnlyTransaction(R
equestContext.java:366)

And here is my code that calls it (in my connection pool class):

ConnectionPool:

boolean canReuse()
{
try
{
if ( m_connection.isClosed() )
{
if ( DEBUG )
trace( "Connection was closed!" );

return false;
}
else if ( ++m_usageCount >=
ConnectionPool.MAX_CONNECTION_USES )
{
if ( DEBUG )
trace( "Connection has exceeded usage count!" );

return false;
}
else
{
clearWarnings(); // everything okay to reuse connection
return true;
}
}
catch ( final SQLException e )
{
e.printStackTrace();
return false;
}
}

public void clearWarnings()
{
try
{
if ( DEBUG )
{
SQLWarning warning = m_connection.getWarnings();

if ( warning != null )
trace( "Dumping warnings...." );

for ( ; warning != null; warning =
warning.getNextWarning() )
warning.printStackTrace();
}

#### m_connection.clearWarnings(); ####
}
catch ( Exception e )
{
e.printStackTrace();
}
}