0

Java application terminates with exception:

liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.NumberFormatException
        at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:211)
        at liquibase.integration.commandline.Main.doMigration(Main.java:967)
        at liquibase.integration.commandline.Main.run(Main.java:180)
        at liquibase.integration.commandline.Main.main(Main.java:99)
Caused by: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.NumberFormatException
        at liquibase.command.AbstractCommand.execute(AbstractCommand.java:13)
        at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:209)
        ... 3 more
Caused by: liquibase.exception.DatabaseException: java.lang.NumberFormatException
        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:120)
        at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:73)
        at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:194)
        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:292)
        at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:314)
        at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:234)
        at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:208)
        at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:70)
        at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:44)
        at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:21)
        at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:150)
        at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:139)
        at liquibase.command.DiffCommand.createReferenceSnapshot(DiffCommand.java:190)
        at liquibase.command.DiffCommand.createDiffResult(DiffCommand.java:140)
        at liquibase.command.DiffToChangeLogCommand.run(DiffToChangeLogCommand.java:51)
        at liquibase.command.AbstractCommand.execute(AbstractCommand.java:8)
        ... 4 more
Caused by: java.lang.NumberFormatException
        at java.math.BigDecimal.<init>(Unknown Source)
        at java.math.BigDecimal.<init>(Unknown Source)
        at java.math.BigDecimal.<init>(Unknown Source)
        at liquibase.util.SqlUtil.parseValue(SqlUtil.java:208)
        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readDefaultValue(ColumnSnapshotGenerator.java:387)
        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readColumn(ColumnSnapshotGenerator.java:223)
        at liquibase.snapshot.jvm.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:115)
        ... 20 more

I now that NumberFormatException should contain "For input string" text. What can I do to view the message text for that exception?

Not from code, this is a compiled jar application which is run with bat file like this:

java -cp "%CP%" %JAVA_OPTS% liquibase.integration.commandline.Main %CMD_LINE_ARGS%
Vlad
  • 3,001
  • 1
  • 22
  • 52
  • What java runtime do you use to run your application? – SpaceTrucker Feb 08 '16 at 12:15
  • Related question (how to do it if you control the code yourself): http://stackoverflow.com/questions/1791610/java-find-the-first-cause-of-an-exception – Klas Lindbäck Feb 08 '16 at 12:16
  • @SpaceTrucker Java(TM) SE Runtime Environment (build 1.8.0_66-b18) – Vlad Feb 08 '16 at 12:16
  • 1
    *I now that NumberFormatException should contain "For input string" text.* - What makes you think that? – Aleksandr M Feb 08 '16 at 12:24
  • `BigDecimal` doesn't use such a string literal (see http://hg.openjdk.java.net/jdk8u/jdk8u60/jdk/file/935758609767/src/share/classes/java/math/BigDecimal.java) – SpaceTrucker Feb 08 '16 at 12:27
  • @AleksandrM I saw it there: https://liquibase.jira.com/browse/CORE-2504 – Vlad Feb 08 '16 at 12:29
  • 1
    @Vlad, the stack trace in the jira ticket has its root cause in Integer not BigDecimal as in your case. If you look in BigDecimal code, you will see that most of the case the non argument constructor is used for the NumberFormatException and in any case, the input is never part of the message (the real constructor use a byte array as input which is not nice to simply add the error message). – Kazaag Feb 08 '16 at 12:34

1 Answers1

2
Caused by: java.lang.NumberFormatException

...

I now that NumberFormatException should contain "For input string" text. What can I do to view the message text for that exception?

There may not be a message for you to view. If the NumberFormatException had a detail message, it would be part of the stack trace. Here is the javadoc for NumberFormatException. You will note that there's no guarantee the exception will have a detailed message. In fact, it has a no-argument constructor which is documented to construct "a NumberFormatException with no detail message".

Additionally, here is the main constructor for the OpenJDK implementation of the BigDecimal class. If you look through it, you'll see that it throws NumberFormatExceptions with no detail message in a few places.

Kenster
  • 23,465
  • 21
  • 80
  • 106