]> juplo.de Git - hibernate4-maven-plugin/commitdiff
Bugfix: connection was closed, even when it was never created
authorKai Moritz <kai@coolibri.de>
Wed, 9 Jan 2013 19:57:22 +0000 (20:57 +0100)
committerKai Moritz <kai@coolibri.de>
Tue, 15 Jan 2013 20:41:04 +0000 (21:41 +0100)
Bugreport from: Adriano Machado <adriano.m.machado@hotmail.com>

When only the script is generated and no export is executed, no database-
connection is opend. Nevertheless, the code tried to close it in the
finally-block, which lead to a NPE.

src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java

index 81cef938411d21461eeb7e9f79f5b675cca1558c..78793bb53a6063e554d3ffa7ed5bd4b988e4e29b 100644 (file)
@@ -601,7 +601,8 @@ public class Hbm2DdlMojo extends AbstractMojo
       /** Close the connection */
       try
       {
-        connection.close();
+        if (connection != null)
+          connection.close();
       }
       catch (SQLException e)
       {