java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java
branchv_0
changeset 101 97b0d9069133
parent 96 7ae30649b30b
child 104 245f1b88a3e6
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Sun Dec 29 18:26:43 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Mon Dec 30 00:01:39 2013 +0100
     1.3 @@ -141,8 +141,9 @@
     1.4  		FormatterDefinition fd = configuration.getFormatter(options.getFormatterName());
     1.5  		try (DatabaseConnection c = dd.connect()) {
     1.6  			log.log(Level.FINE, "Database connected");
     1.7 -			Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream()));
     1.8 -			c.executeQuery(options.getSQLCommand(), f);
     1.9 +			try (Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream()))) {
    1.10 +				c.executeQuery(options.getSQLCommand(), f);
    1.11 +			}
    1.12  		}
    1.13  	}
    1.14