@Test public void releaseConnection_null_shouldSucceed() throws SQLException { DataSource ds = EasyMock.createMock(DataSource.class); EasyMock.replay(ds); J2EEConnectionPool pool = new J2EEConnectionPool(ds); pool.releaseConnection(null); EasyMock.verify(ds); }
@Override public void releaseConnection(Connection conn) { if (conn != null) { try { conn.close(); } catch (SQLException e) { Logger.getLogger(J2EEConnectionPool.class.getName()).log( Level.FINE, "Could not release SQL connection", e); } } }
J2EEConnectionPool implements JDBCConnectionPool { @Override public void releaseConnection(Connection conn) { if (conn != null) { try { conn.close(); } catch (SQLException e) { Logger.getLogger(J2EEConnectionPool.class.getName()).log( Level.FINE, "Could not release SQL connection", e); } } } }
J2EEConnectionPool implements JDBCConnectionPool { @Override public void releaseConnection(Connection conn) { if (conn != null) { try { conn.close(); } catch (SQLException e) { Logger.getLogger(J2EEConnectionPool.class.getName()).log( Level.FINE, "Could not release SQL connection", e); } } } J2EEConnectionPool(DataSource dataSource);  J2EEConnectionPool(String dataSourceJndiName); }
J2EEConnectionPool implements JDBCConnectionPool { @Override public void releaseConnection(Connection conn) { if (conn != null) { try { conn.close(); } catch (SQLException e) { Logger.getLogger(J2EEConnectionPool.class.getName()).log( Level.FINE, "Could not release SQL connection", e); } } } J2EEConnectionPool(DataSource dataSource);  J2EEConnectionPool(String dataSourceJndiName); @Override Connection reserveConnection(); @Override void releaseConnection(Connection conn); @Override void destroy(); }
J2EEConnectionPool implements JDBCConnectionPool { @Override public void releaseConnection(Connection conn) { if (conn != null) { try { conn.close(); } catch (SQLException e) { Logger.getLogger(J2EEConnectionPool.class.getName()).log( Level.FINE, "Could not release SQL connection", e); } } } J2EEConnectionPool(DataSource dataSource);  J2EEConnectionPool(String dataSourceJndiName); @Override Connection reserveConnection(); @Override void releaseConnection(Connection conn); @Override void destroy();  }