graal icon indicating copy to clipboard operation
graal copied to clipboard

[GR-30070] InvalidPathException when target file path have Chinese path

Open itning opened this issue 3 years ago • 3 comments

When HelloWorld.class file have Chinese path, such as C://哈哈/HelloWorld.class

>native-image HelloWorld
Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <?> at index 3: G:\?????\??
        at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
        at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
        at java.nio.file.Paths.get(Paths.java:84)
        at com.oracle.svm.core.util.ClasspathUtils.stringToClasspath(ClasspathUtils.java:50)
        at com.oracle.svm.hosted.AbstractNativeImageClassLoaderSupport$Util.toClassPathEntries(AbstractNativeImageClassLoaderSupport.java:121)
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)
        at java.util.Iterator.forEachRemaining(Iterator.java:116)
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:546)
        at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
        at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:505)
        at com.oracle.svm.hosted.AbstractNativeImageClassLoaderSupport$Util.verifyClassPathAndConvertToURLs(AbstractNativeImageClassLoaderSupport.java:117)
        at com.oracle.svm.hosted.AbstractNativeImageClassLoaderSupport.<init>(AbstractNativeImageClassLoaderSupport.java:79)
        at com.oracle.svm.hosted.NativeImageClassLoaderSupport.<init>(NativeImageClassLoaderSupport.java:36)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.installNativeImageClassLoader(NativeImageGeneratorRunner.java:154)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:118)
Error: Image build request failed with exit status 1

This is my version:

>  native-image --version
GraalVM Version 21.0.0.2 (Java Version 1.8.0_282-b07)
> java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-b07)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 25.282-b07-jvmci-21.0-b06, mixed mode)
> $psversiontable

Name                           Value
----                           -----
PSVersion                      5.1.19041.610
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.610
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

itning avatar Mar 13 '21 15:03 itning

Thank you for reporting this, the issue is tracked internally by GR-30070

oubidar-Abderrahim avatar Mar 16 '21 10:03 oubidar-Abderrahim

I have the same issue in a native-image build with of GraalVM CE 21, compiled with -Dfile.encoding=UTF-8.

volgar1x avatar Oct 10 '23 12:10 volgar1x

Here is a Gist with some Java sources and a Dockerfile to reproduce : https://gist.github.com/volgar1x/3b27360eac7b989c167bf7d548135f9c

volgar1x avatar Oct 10 '23 18:10 volgar1x