Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8207768

Improve exception messages during manifest parsing of jar archives

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 12
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Interface Kind:
      System or security property
    • Scope:
      JDK

      Description

      Summary

      Exception messages during manifest parsing of jar archives will be enhanced; it is planned to add the jar-path and line number of the manifest causing the exception into the exception messages. To enable/disable the additional information in the exception messages, the system and security property "jdk.includeInExceptions" shall be used. A new category "jar" is added to its supported values. This will enable more detailed information in the IOExceptions thrown by classes in the java.util.jar package.

      Problem

      Better exception messages help the users to find out the source of problems; however there are security concerns to show the jar-paths by default, so a new category for system and security property "jdk.includeInExceptions" is added to enable/disable the jar paths in the exception messages.

      Solution

      The method int read(Manifest.FastInputStream is, byte[] lbuf, String filename, int lineNumber) in class java/util/jar/Attributes and the method void read(InputStream is) in class java/util/jar/Manifest will be changed to add the line number and optionally the jar-file path to the IOExceptions generated in error cases. By default, the jar-path information will not be added to the message; however the value "jar" can be added to system and security property jdk.includeInExceptions (jdk.includeInExceptions=jar). That means we reuse the already existing security property jdk.includeInExceptions that has been added recently to control the information level of socket exceptions.

      Specification

      The current webrev of the proposed implementation can be found here: http://cr.openjdk.java.net/~mbaesken/webrevs/8205525.12/

      The proposed addition to the java.security file is as follows:

      1063 #
      1064 # Enhanced exception message information
       .....
      1073 # The categories are:
       ....
      1078 #
      1079 #  jar -   enables more detailed information in the IOExceptions thrown
      1080 #            by classes in the java.util.jar package
      1081 #
       ....
      1084 #
      1085 #jdk.includeInExceptions=hostInfo,jar

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mbaesken Matthias Baesken
                Reporter:
                mbaesken Matthias Baesken
                Reviewed By:
                Christoph Langer, Weijun Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: