1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java Sun Dec 29 18:26:43 2013 +0100
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java Mon Dec 30 00:01:39 2013 +0100
1.3 @@ -66,20 +66,26 @@
1.4 case DATABASES:
1.5 case FORMATTERS:
1.6 case TYPES:
1.7 - formatter = getFormatter();
1.8 - formatter.writeStartBatch();
1.9 - formatter.writeStartDatabase(new DatabaseDefinition());
1.10 + try (Formatter f = getFormatter()) {
1.11 + formatter = f;
1.12 + formatter.writeStartBatch();
1.13 + formatter.writeStartDatabase(new DatabaseDefinition());
1.14 + showInfos(commands);
1.15 + formatter.writeEndDatabase();
1.16 + formatter.writeEndBatch();
1.17 + formatter.close();
1.18 + }
1.19 + break;
1.20 + default:
1.21 + showInfos(commands);
1.22 }
1.23 }
1.24 + }
1.25
1.26 + private void showInfos(EnumSet<InfoType> commands) throws ConfigurationException, FormatterException {
1.27 for (InfoType infoType : commands) {
1.28 infoType.showInfo(this);
1.29 }
1.30 -
1.31 - if (formatter != null) {
1.32 - formatter.writeEndDatabase();
1.33 - formatter.writeEndBatch();
1.34 - }
1.35 }
1.36
1.37 private void listFormatters() throws ConfigurationException, FormatterException {