gpt4 book ai didi

java - 如何在不更改代码的情况下从编译的 jar 中检索完整的异常消息?

转载 作者:行者123 更新时间:2023-12-02 03:57:42 36 4
gpt4 key购买 nike

Java 应用程序异常终止:

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

我现在 NumberFormatException 应该包含“For input string”文本。我可以做什么来查看该异常的消息文本?

不是来自代码,这是一个编译的 jar 应用程序,它使用这样的 bat 文件运行:

java -cp "%CP%" %JAVA_OPTS% liquibase.integration.commandline.Main %CMD_LINE_ARGS%

最佳答案

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?

可能没有消息可供您查看。如果 NumberFormatException 有详细消息,它将成为堆栈跟踪的一部分。 Here is the javadoc for NumberFormatException 。您会注意到,不能保证异常会包含详细消息。事实上,它有a no-argument constructor它被记录为构造“没有详细消息的 NumberFormatException”。

此外,here is the main constructor用于 BigDecimal 类的 OpenJDK 实现。如果您仔细查看它,您会发现它在一些地方抛出 NumberFormatExceptions 且没有详细消息。

关于java - 如何在不更改代码的情况下从编译的 jar 中检索完整的异常消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35269340/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com