From ddae3adfca3018f990139ab11688214a81fc8e20 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 8 Dec 2020 15:19:03 +0100 Subject: [PATCH] [jOOQ/jOOQ#11105] NullPointerException when GenerationTool is not properly initialised --- .../src/main/java/org/jooq/codegen/GenerationTool.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java b/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java index 14223323ef..c5b661b415 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java +++ b/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java @@ -903,7 +903,9 @@ public class GenerationTool { // Close connection only if it was created by the GenerationTool if (connection != null) { if (close) { - if (ctx.family() == HSQLDB && dataSource == null) + + // [#11105] In case of misconfiguration, the ctx reference could be null as a side effect + if (ctx != null && ctx.family() == HSQLDB && dataSource == null) ctx.execute("shutdown"); connection.close();