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

javac errors after JDK-8251329 are not helpful enough to find root cause

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b09
    • Introduced In Version:
      18
    • Resolved In Build:
      b23

      Backports

        Description

        After JDK-8251329, we see javac errors with messages like this:
         

        Hello.java:1: error: cannot access unnamed package
        import java.util.Date;
        ^
        ZIP file can't be opened as a file system because an entry has a '.' or '..' element in its name
        1 error

         
        The error is caused by some now invalid jar file (due to . or .. in entry names) which does not necessarily have to do with the compilation unit on which the error is thrown. The error message does not give a clue which jar file is causing the problem. This can be improved to something like:


        Hello.java:1: error: cannot access unnamed package
        import java.util.Date;
        ^
        ZipException opening "invalid.jar": ZIP file can't be opened as a file system because an entry has a '.' or '..' element in its name
        1 error

        To recreate, I have attached a little Java program "GenerateInvalidJar" that generates an invalid jar named invalid.jar which is attached as binary, too. Then, you can call javac -cp invalid.jar Hello.java to provoke the error.

          Attachments

          1. GenerateInvalidJar.java
            0.9 kB
          2. Hello.java
            0.1 kB
          3. invalid.jar
            0.1 kB

            Issue Links

              Activity

                People

                Assignee:
                clanger Christoph Langer
                Reporter:
                clanger Christoph Langer
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: