fix: try/catch v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 16 Dec 2013 12:10:45 +0100
branchv_0
changeset 13599aad77e986
parent 12 2dcb67d90fd2
child 14 189b1260b942
fix: try/catch
java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java
java/sql-dk/test/info/globalcode/sql/dk/CLIParserTest.java
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Mon Dec 16 00:29:22 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Mon Dec 16 12:10:45 2013 +0100
     1.3 @@ -1,13 +1,22 @@
     1.4  package info.globalcode.sql.dk;
     1.5  
     1.6 +import java.util.logging.Level;
     1.7 +import java.util.logging.Logger;
     1.8 +
     1.9  /**
    1.10   *
    1.11   * @author Ing. František Kučera (frantovo.cz)
    1.12   */
    1.13  public class CLIStarter {
    1.14  
    1.15 +	private static final Logger log = Logger.getLogger(CLIStarter.class.getName());
    1.16 +
    1.17  	public static void main(String[] args) {
    1.18 -		CLIParser parser = new CLIParser();
    1.19 -		CLIOptions options = parser.parseOptions(args);
    1.20 +		try {
    1.21 +			CLIParser parser = new CLIParser();
    1.22 +			CLIOptions options = parser.parseOptions(args);
    1.23 +		} catch (CLIParserException e) {
    1.24 +			log.log(Level.SEVERE, null, e);
    1.25 +		}
    1.26  	}
    1.27  }
     2.1 --- a/java/sql-dk/test/info/globalcode/sql/dk/CLIParserTest.java	Mon Dec 16 00:29:22 2013 +0100
     2.2 +++ b/java/sql-dk/test/info/globalcode/sql/dk/CLIParserTest.java	Mon Dec 16 12:10:45 2013 +0100
     2.3 @@ -111,7 +111,7 @@
     2.4  			Tokens.DB, DATABASE_NAME_1,
     2.5  			Tokens.SQL, SQL_1,
     2.6  			Tokens.NAME_PREFIX, "$",
     2.7 -			Tokens.TYPES, " " + NAME_1 + TYPE_NAME_SEPARATOR + "int" + "," + NAME_2 + TYPE_NAME_SEPARATOR + "string" + "," + NAME_3 + TYPE_NAME_SEPARATOR + "boolean",
     2.8 +			Tokens.TYPES, " " + NAME_1 + TYPE_NAME_SEPARATOR + "int" + "," + NAME_3 + TYPE_NAME_SEPARATOR + "boolean",
     2.9  			Tokens.DATA, "$" + NAME_1, DATA_1, "$" + NAME_2, DATA_2, "$" + NAME_3, DATA_3};
    2.10  		CLIOptions options = parser.parseOptions(args);
    2.11  		options.validate();
    2.12 @@ -121,7 +121,7 @@
    2.13  		assertEquals(options.getMode(), CLIOptions.MODE.QUERY_NOW);
    2.14  		assertEquals(options.getNamedParameters().size(), 3);
    2.15  		assertNamedParameter(options.getNamedParameters(), NAME_1, DATA_1, Types.INTEGER);
    2.16 -		assertNamedParameter(options.getNamedParameters(), NAME_2, DATA_2, Types.VARCHAR);
    2.17 +		assertNamedParameter(options.getNamedParameters(), NAME_2, DATA_2, Parameter.DEFAULT_TYPE);
    2.18  		assertNamedParameter(options.getNamedParameters(), NAME_3, DATA_3, Types.BOOLEAN);
    2.19  	}
    2.20