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

Escaped character at specific position in argument file is not handled properly

    XMLWordPrintable

Details

    • b14
    • x86_64
    • windows_10

    Backports

      Description

        ADDITIONAL SYSTEM INFORMATION :
        Can be reproduced on JDK 9.0.4/10.0.2/11+28, Windows 7 and 10

        A DESCRIPTION OF THE PROBLEM :
        Recently we found our application throws `ClassNotFoundException`. After some investigation, this is an issue affecting JDK 9/10/11 (which supports @optionFile in `java` argument list) on Windows.

        REGRESSION : Last worked in version 11

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        I created a repo to reproduce it:

        https://github.com/blindpirate/jdk-cp-option-file-issue

        - On Windows (tested on Win 7/10 With 9.0.4/10.0.2/11+28).
        - Clone https://github.com/blindpirate/jdk-cp-option-file-issue
        - Copy `groovy/groovy-all-2.4.15.jar` to `C:\tcagent1\work-1234567890123456-subprojects-tooling-api-build-integ-test-lib\groovy-all-2.4.15.jar` (this path is at the end of `problematic-cp.txt` file). What matters is the path length.
        - `cd jdk-cp-option-file-issue`.
        - Run `javac -cp '.;./groovy/groovy-all-2.4.15.jar' Main.java` to perform a compilation.
        - Run `java @problematic-cp.txt Main` you get a `java.lang.NoClassDefFoundError: groovy/lang/GroovyObject`.
        - Modify `problematic-cp.txt`, add or remove one character in the `-cp` list (don't change the ending `C:\\tcagent1\\work-1234567890123456-subprojects-tooling-api-build-integ-test-lib\\groovy-all-2.4.15.jar;."`), for example, change `C:\\tcagent1\\work\\1234567890123456\\intTestHomeDir\\worker-1\\caches\\4.10.1-20180912160000+0000\\workerMain\\gradle-worker.jar` to `C:\\tcagent1\\work\\1234567890123456\\intTestHomeDir\\worker-1\\caches\\4.10.1-20180912160000+0000\\workerMain\\gradle-worker.ja`
        - Run `java @problematic-cp.txt Main` you get the successful result.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Classpath can be read from option file.
        ACTUAL -
        It doesn't work somehow.

        CUSTOMER SUBMITTED WORKAROUND :
        Not found.

        FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

                henryjen Henry Jen
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: