-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe GraalVM and your environment :
- GraalVM version or commit id if built from source: 23.1.1
- CE or EE: CE
- JDK version: JDK17
- OS and OS Version: Windows 11
- Architecture: x64
- The output of
java -Xinternalversion
:
OpenJDK 64-Bit Server VM (17.0.8.1+1) for windows-amd64 JRE (17.0.8.1+1), built on Aug 23 2023 15:29:17 by "admin" with MS VC++ 16.7 (VS2019)
Have you verified this issue still happens when using the latest snapshot?
No, but I checked the source and the code leading to this is unchanged
Describe the issue
Trying to create a js ScriptEngine in an web environment that utilizes the URLClassloader (e.g. Tomcat) under Windows leads to the below StackTrace. The problem is that the Engine.ClassPathIsolation.collectClassPathJars Method uses the URL -> URI -> getPath method to feed Path.of. Which doesn't work with the : contained in /C:/ . This should be handled like e.g in LanguageCache getLanguageHomeFromURLConnection which had the same problem in the past.
Steps to reproduce the issue
URL url = new URL("file:/C:/test");
URI uri = url.toURI();
Path working= Path.of(uri);
Path notWorking = Path.of(uri.getPath());
Expected behavior
Able to create a ScriptEngine under Windows
Additional context
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/.......
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
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:232)
at java.base/java.nio.file.Path.of(Path.java:147)
at org.graalvm.polyglot.Engine$ClassPathIsolation.collectClassPathJars(Engine.java:1988)
at org.graalvm.polyglot.Engine$ClassPathIsolation.createIsolatedTruffleModule(Engine.java:1783)
at org.graalvm.polyglot.Engine$ClassPathIsolation.createIsolatedTruffle(Engine.java:1723)
at org.graalvm.polyglot.Engine$1.searchServiceLoader(Engine.java:1682)
at org.graalvm.polyglot.Engine$1.run(Engine.java:1668)
at org.graalvm.polyglot.Engine$1.run(Engine.java:1663)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at org.graalvm.polyglot.Engine.initEngineImpl(Engine.java:1663)
at org.graalvm.polyglot.Engine$ImplHolder.<clinit>(Engine.java:186)