diff --git a/src/test/org/firebirdsql/common/FBTestBase.java b/src/test/org/firebirdsql/common/FBTestBase.java index b1165baf5f..1e009db986 100644 --- a/src/test/org/firebirdsql/common/FBTestBase.java +++ b/src/test/org/firebirdsql/common/FBTestBase.java @@ -243,4 +243,36 @@ protected void tearDown() throws Exception { gdsTypeToUrlPrefixMap.put(GDSType.getType("NIO"), "jdbc:firebirdsql:nio:"); } + + /** + * Helper method to quietly close statements. + * + * @param stmt Statement object + */ + protected void closeQuietly(Statement stmt) { + if (stmt == null) { + return; + } + try { + stmt.close(); + } catch (SQLException ex) { + //ignore + } + } + + /** + * Helper method to quietly close connections. + * + * @param stmt Statement object + */ + protected void closeQuietly(Connection con) { + if (con == null) { + return; + } + try { + con.close(); + } catch (SQLException ex) { + //ignore + } + } }