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

jar --validate should check inital entries of a JAR file

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: New
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
      jar
    • CPU:
      generic
    • OS:
      generic

      Description

      Certain documentations and implementations make assumptions about the initial entries found in a valid JAR file. Here are two examples:

      "
              // This implementation assumes the META-INF/MANIFEST.MF entry
              // should be either the first or the second entry (when preceded
              // by the dir META-INF/). It skips the META-INF/ and then
              // "consumes" the MANIFEST.MF to initialize the Manifest object.
      "
      https://github.com/openjdk/jdk/blob/49112fa5752174a77fb5cd276fdd4240bf76bf82/src/java.base/share/classes/java/util/jar/JarInputStream.java#L78-L81

      "
      The jar tool automatically generates a manifest file entry named META-INF/MANIFEST.MF. It is always the first entry in the jar file.
      "
      https://docs.oracle.com/javase/7/docs/technotes/tools/solaris/jar.html

      The --validate option introduced into the jar tool in Java 17 seems to be a good place to check these assumptions.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            cstein Christian Stein
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: