--- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java Thu Dec 26 22:39:38 2013 +0100
+++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java Fri Dec 27 00:57:34 2013 +0100
@@ -122,19 +122,11 @@
private void processQueryNow() throws ConfigurationException, SQLException, FormatterException {
DatabaseDefinition dd = getConfiguration().getDatabase(options.getDatabaseName());
- if (dd == null) {
- throw new ConfigurationException("Database is not configured: " + options.getDatabaseName());
- } else {
- FormatterDefinition fd = configuration.getFormatter(options.getFormatterName());
- if (fd == null) {
- throw new ConfigurationException("Formatter is not configured: " + options.getFormatterName());
- } else {
- try (DatabaseConnection c = dd.connect()) {
- log.log(Level.FINE, "Database connected");
- Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream()));
- c.executeQuery(options.getSQLCommand(), f);
- }
- }
+ FormatterDefinition fd = configuration.getFormatter(options.getFormatterName());
+ try (DatabaseConnection c = dd.connect()) {
+ log.log(Level.FINE, "Database connected");
+ Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream()));
+ c.executeQuery(options.getSQLCommand(), f);
}
}