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

jdk/java/lang/instrument/BootClassPath/BootClassPathTest.sh fails on Japanese Windows

XMLWordPrintable

        I would like to make two modifications to this test
        because it dose not work as intended.

        First, the purpose of BootClassPathTest.sh is to test non US-ASCII characters
        in the value of the Boot-Class-Path in MANIFEST.MF,
        but it fails to create the path on some environments.

        The path name is defined at names[][] array in Setup.java, which is defined based on Charset.defaultCharset().name().
        Setup.java uses sun.jnu.encoding property for JEP 400, therefor names[][] array should be defined based on sun.jnu.encoding.

        Second, the BOOTDIR environment value in BootClassPathTest.sh is not set correctly on the Windows cygwin.

        BOOTDIR=`cat ${TESTCLASSES}/boot.dir`

        "$JAVAC" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d "${BOOTDIR}" \
            "${TESTSRC}"/AgentSupport.java

        The path name is written in the file boot.dir with the native encording,
        but the default encording is UTF8 on the Windows cygwin.
        This is the reason why BootClassPathTest.sh fails to pass the directory name to JAVAC -d "${BOOTDIR}"

        As a side note, the directory is created with the native encording correctly.

        I tried to use LANG/LC_CTYPE/LC_ALL according to https://cygwin.com/cygwin-ug-net/setup-locale.html, but it does not work well.
        The only way that works is to write the path name in boot.dir with UTF8
        which is the default encording on the Windows cygwin.

        I would like to make two modifications to this test.

        If the second modification has not done it fails on Japanese Windows with the following error:

        Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <?> at index 106: C:/work/jdk_latest/jdk/tes
        t/jdk/JTwork/classes/java/lang/instrument/BootClassPath/BootClassPathTest.d\\boot???{??
                at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:204)
                at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:175)
                at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
                at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
                at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:231)
                at java.base/java.nio.file.Path.of(Path.java:148)
                at java.base/java.nio.file.Paths.get(Paths.java:69)
                at jdk.compiler/com.sun.tools.javac.main.Arguments.checkDirectory(Arguments.java:861)
                at jdk.compiler/com.sun.tools.javac.main.Arguments.validate(Arguments.java:471)
                at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:278)
                at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
                at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
                at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)
        Exception in thread "main" java.lang.reflect.InvocationTargetException
                at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
                at java.base/java.lang.reflect.Method.invoke(Method.java:580)
                at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:560)
                at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:572)
        Caused by: java.lang.ClassNotFoundException: AgentSupport
                at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
                at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
                at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
                at java.base/java.lang.Class.forName0(Native Method)
                at java.base/java.lang.Class.forName(Class.java:421)
                at java.base/java.lang.Class.forName(Class.java:412)
                at Agent.premain(Agent.java:36)
                at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
                ... 3 more

              kyukihiro Kimura Yukihiro
              kyukihiro Kimura Yukihiro
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: