javaexceptionruntime-errormessagebrackets

Java Runtime Exception Message :: What Do Brackets Mean?


my company has a custom Java app that is recently crashing when we try to run it. Here's the stacktrace when it blows up:

java.lang.NullPointerException: null
        at java.util.regex.Matcher.getTextLength(Matcher.java:1283) ~[?:1.8.0_345]
        at java.util.regex.Matcher.reset(Matcher.java:309) ~[?:1.8.0_345]
        at java.util.regex.Matcher.<init>(Matcher.java:229) ~[?:1.8.0_345]
        at java.util.regex.Pattern.matcher(Pattern.java:1093) ~[?:1.8.0_345]
        at com.mycompany.fileUtility.checkFiles.validateData(fileUtility.java:112) ~[wonderApp.jar:?]
        at com.mycompany.wonderApp.BuildConfig.<init>(BuildConfig.java:78) ~[wonderApp.jar:?]
        at com.mycompany.wonderApp.ConfigMonitor.build(ConfigMonitor.java:698) [wonderApp.jar:?]
        at com.mycompany.wonderApp.MainDriver.Main(MainDriver.java:18) [wonderApp.jar:?]

My question is: What is that information in brackets? i.e. ~[?:1.8.0_345] for the Java library functions, and ~[wonderApp.jar:?] for the custom code stuff? What does the colon mean? What does the ? signify? For that matter, what about the ~ outside the brackets?

FYI, our platform is Red Hat Enterprise Linux 7.9. Our version of Java is:

[me@server01 tmp]$ java -version
openjdk version "1.8.0_345"
OpenJDK Runtime Environment (build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (build 25.345-b01, mixed mode)
[me@server01 tmp]$

Thank you.


Solution

  • It looks like it's using logback as the logging implementation, and the pattern layout for the log message is dumping the exception stack as described in this table:

    At the end of each stack frame of the exception, a string consisting of the jar file containing the relevant class followed by the "Implementation-Version" as found in that jar's manifest will be added. [...] If the information is uncertain, then the class packaging data will be preceded by a tilde, i.e. the '~' character.