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

JDK 9 cannot load jar files where the modified day or month is 0

    Details

      Description

      FULL PRODUCT VERSION :
      java version "9.0.1"
      Java(TM) SE Runtime Environment (build 9.0.1+11)
      Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin 17.3.0

      A DESCRIPTION OF THE PROBLEM :
      This is a duplicate of https://bugs.openjdk.java.net/browse/JDK-8184940 which has only been fixed in JDK 10. Can this fix be back-ported to the JDK-9 branch as well?

      If you try to use a jar file that has invalid dates in it then the compiler will fail with the following error:

      ```
      An exception has occurred in the compiler (9.0.1). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 0
      at java.base/java.time.temporal.ValueRange.checkValidValue(ValueRange.java:311)
      at java.base/java.time.temporal.ChronoField.checkValidValue(ChronoField.java:714)
      at java.base/java.time.LocalDate.of(LocalDate.java:269)
      at java.base/java.time.LocalDateTime.of(LocalDateTime.java:336)
      at jdk.zipfs/jdk.nio.zipfs.ZipUtils.dosToJavaTime(ZipUtils.java:109)
      at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem$Entry.cen(ZipFileSystem.java:1950)
      at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem$Entry.readCEN(ZipFileSystem.java:1937)
      at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.getEntry(ZipFileSystem.java:1324)
      at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.newInputStream(ZipFileSystem.java:550)
      at jdk.zipfs/jdk.nio.zipfs.JarFileSystem.isMultiReleaseJar(JarFileSystem.java:91)
      at jdk.zipfs/jdk.nio.zipfs.JarFileSystem.<init>(JarFileSystem.java:67)
      at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:134)
      at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer.<init>(JavacFileManager.java:517)
      at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getContainer(JavacFileManager.java:319)
      at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.list(JavacFileManager.java:715)
      at jdk.compiler/com.sun.tools.javac.code.ClassFinder.list(ClassFinder.java:722)
      at jdk.compiler/com.sun.tools.javac.code.ClassFinder.scanUserPaths(ClassFinder.java:648)
      at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:529)
      at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:293)
      at jdk.compiler/com.sun.tools.javac.code.Symtab.lambda$addRootPackageFor$7(Symtab.java:758)
      at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:633)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:354)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:529)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:285)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:300)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:570)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:554)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1052)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:923)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:302)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:162)
      at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
      at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
      ```

      REGRESSION. Last worked in version 8u144

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      If you download a jar that has invalid dates and put it on the classpath then you will get the error.

      e.g.

      > curl -O http://central.maven.org/maven2/org/apache/beam/beam-sdks-java-core/2.2.0/beam-sdks-java-core-2.2.0.jar

      > javac -cp beam-sdks-java-core-2.2.0.jar HelloWorld.java

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      In JDK 8 javac is able to load classes from a jar file with invalid modified dates
      ACTUAL -
      > javac -cp beam-sdks-java-core-2.2.0.jar HelloWorld.java
      An exception has occurred in the compiler (9.0.1). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 0
      at java.base/java.time.temporal.ValueRange.checkValidValue(ValueRange.java:311)
      at java.base/java.time.temporal.ChronoField.checkValidValue(ChronoField.java:714)
      at java.base/java.time.LocalDate.of(LocalDate.java:269)
      at java.base/java.time.LocalDateTime.of(LocalDateTime.java:336)
      at jdk.zipfs/jdk.nio.zipfs.ZipUtils.dosToJavaTime(ZipUtils.java:109)
      at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem$Entry.cen(ZipFileSystem.java:1950)
      at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem$Entry.readCEN(ZipFileSystem.java:1937)
      at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.getEntry(ZipFileSystem.java:1324)
      at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.newInputStream(ZipFileSystem.java:550)
      at jdk.zipfs/jdk.nio.zipfs.JarFileSystem.isMultiReleaseJar(JarFileSystem.java:91)
      at jdk.zipfs/jdk.nio.zipfs.JarFileSystem.<init>(JarFileSystem.java:67)
      at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:134)
      at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer.<init>(JavacFileManager.java:517)
      at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getContainer(JavacFileManager.java:319)
      at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.list(JavacFileManager.java:715)
      at jdk.compiler/com.sun.tools.javac.code.ClassFinder.list(ClassFinder.java:722)
      at jdk.compiler/com.sun.tools.javac.code.ClassFinder.scanUserPaths(ClassFinder.java:648)
      at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:529)
      at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:293)
      at jdk.compiler/com.sun.tools.javac.code.Symtab.lambda$addRootPackageFor$7(Symtab.java:758)
      at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:633)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:354)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:529)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:285)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:300)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:570)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:554)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1052)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:923)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:302)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:162)
      at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
      at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      I'm not sure there is a simple work around except to un-jar the broken jar file and re-jar with valid modified dates.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psonal Pallavi Sonal (Inactive)
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: