Permalink
Browse files

fix: avoid NPE in PgConnection.finalize

Note: the NPE is not visible to the end users as it can be caught in debugger only.

fixes #1206
  • Loading branch information...
vlsi committed Jun 5, 2018
1 parent 38356e6 commit 03a1441bbe98525412df754d3934141bc3b12168
Showing with 5 additions and 0 deletions.
  1. +5 −0 pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java
@@ -655,6 +655,11 @@ private void initObjectTypes(Properties info) throws SQLException {
* {@inheritDoc}
*/
public void close() throws SQLException {
if (queryExecutor == null) {
// This might happen in case constructor throws an exception (e.g. host being not available).
// When that happens the connection is still registered in the finalizer queue, so it gets finalized
return;
}
releaseTimer();
queryExecutor.close();
openStackTrace = null;

0 comments on commit 03a1441

Please sign in to comment.