Vlad
Vlad

Reputation: 3171

How to retrieve full exception message from compiled jar without changing the code?

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%

Upvotes: 0

Views: 194

Answers (1)

Kenster
Kenster

Reputation: 25380

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.

Upvotes: 2

Related Questions