Improve jpackage error reporting

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • 27
    • Affects Version/s: 26
    • Component/s: tools
    • None
    • Fix Understood
    • generic
    • generic

      A few improvements for jpackage error reporting:

      1. jpackage error messages were improved in JDK-8372359. But an update to the "message.error-header" l10n key [1] was missed.

      The value of the "message.error-header" l10n key should be "Error: {0}" instead of the current "{0}".

      2. jpackage will not print the stack trace of an exception unless executed with the --verbose option.

      This is correct behavior for exceptions explicitly created in jpackage code. These exceptions should have messages sufficient to understand the cause of the failure. However, it this approach hides essential information about failures caused by bugs in jpackage code. Say it is an NPE caused by "Optional.of(...)". It doesn't have a message. When jpackage prints it in non-verbose mode, the only output it produces is:
      ---
      java.lang.NullPointerException
      ---

      Not helpful. For internal errors, jpackage must always print a stack trace. This behavior was discovered when working on another patch with bogus changes to jpackage that caused an NPE.

      [1] https://github.com/openjdk/jdk/blob/f52d49925f9c60814a0a34720d7443e748b35c25/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties#L51

            Assignee:
            Alexey Semenyuk
            Reporter:
            Alexey Semenyuk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: