diff --git a/org/postgresql/jdbc2/AbstractJdbc2Connection.java b/org/postgresql/jdbc2/AbstractJdbc2Connection.java index 25a044d..5411c89 100644 --- a/org/postgresql/jdbc2/AbstractJdbc2Connection.java +++ b/org/postgresql/jdbc2/AbstractJdbc2Connection.java @@ -999,10 +999,26 @@ public abstract class AbstractJdbc2Connection implements BaseConnection */ protected void finalize() throws Throwable { - if (openStackTrace != null) - logger.log(GT.tr("Finalizing a Connection that was never closed:"), openStackTrace); + try + { + if (openStackTrace != null) + logger.log(GT.tr("Finalizing a Connection that was never closed:"), openStackTrace); + } + catch (Throwable t) + { + // We want to try to close even if the logging fails. + } + + try + { + close(); + } + catch (Throwable t) + { + // We want the superclass to try to finalize even if we fail. + } - close(); + super.finalize(); } /* diff --git a/org/postgresql/jdbc2/AbstractJdbc2Statement.java b/org/postgresql/jdbc2/AbstractJdbc2Statement.java index a680ca4..f7289bd 100644 --- a/org/postgresql/jdbc2/AbstractJdbc2Statement.java +++ b/org/postgresql/jdbc2/AbstractJdbc2Statement.java @@ -868,9 +868,11 @@ public abstract class AbstractJdbc2Statement implements BaseStatement { close(); } - catch (SQLException e) + catch (Throwable t) { } + + super.finalize(); } /*