flyway 2.2: NumberFormatException thrown when using command line tools. #584
first i using maven 3.1, and duing to Issue #571, i can't using maven-flyway-plugin. so i need to using command-line tools. but when i configured it and type
the exception thrown:
E:\flyway-2.2>flyway info Flyway (Command-line Tool) v.2.2 ERROR: NumberFormatException: For input string: " " ERROR: Occured in java.lang.NumberFormatException.forInputString() at line 65
same as flyway:|any other option|
E:\flyway-2.2>flyway migrate Flyway (Command-line Tool) v.2.2 ERROR: NumberFormatException: For input string: " " ERROR: Occured in java.lang.NumberFormatException.forInputString() at line 65
then, i do exactly steps specified by: http://flywaydb.org/getstarted/firststeps/commandline.html
and the results are same as above.
BTW: now i was unable to using any flyway tools(both maven & command-line).
The text was updated successfully, but these errors were encountered:
after disassemble the flyway-commandline-2.2.jar, i see the -X option, so this time i add it to run:
E:\flyway-2.2>flyway info -X Flyway (Command-line Tool) v.2.2 DEBUG: Adding location to classpath: E:\flyway-2.2\bin\..\jars\h2-1.3.173.jar ERROR: Unexpected error java.lang.NumberFormatException: For input string: " " at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at com.googlecode.flyway.core.util.PropertiesUtils.getIntProperty(PropertiesUtils. java:119) at com.googlecode.flyway.commandline.Main.main(Main.java:84)
seems it caused by the parse logical of "flyway.consoleWidth" property:
Flyway flyway = new Flyway(); flyway.configure(properties); int consoleWidth = PropertiesUtils.getIntProperty(properties, "flyway.consoleWidth", 80);
i don't known what reason cause the "flyway.consoleWidth" have a value (" "). so the parse logical will failed due to format the (" ") value.
i will try to write the migration tools using flyway API by myself to temporarily get around this problem.
ok, i known what happen under the hood, the problem caused by the "flyway.cmd" batch file.\
@REM Detect the width of the console for /F "usebackq tokens=2* skip=4 delims=: " %%A in (`mode con`) do ( set CONSOLE_WIDTH=%%A goto ExitLoop ) :ExitLoop %JAVA_CMD% -cp bin\flyway-commandline-2.2.jar;bin\flyway-core-2.2.jar com.googlecode.flyway.commandline.Main %* -consoleWidth=%CONSOLE_WIDTH%
the environment variable %CONSOLE_WIDTH% can't get correct value in my environment.
well, the "mode con" command output followings:
Microsoft Windows [版本 6.2.9200] (c) 2012 Microsoft Corporation。保留所有权利。 C:\Users\wenbo>mode con 设备状态 CON: --------- 行: 5000 列: 90 键盘速度: 31 键盘延迟: 1 代码页: 936 C:\Users\wenbo>
it's caused by the OS language i am using? it's Chinese character encoding: GBK.