h2database / h2database/h2database
Illegal char <:>when using RunScript on Windows with classpath: in filename
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.6k
- Forks
- 1.3k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 9
Description
RunScript.execute(url, username, password, "classpath:/test.sql", StandardCharsets.UTF_8, false);
works on MacOS and Linux but fails on Windows:
java.nio.file.InvalidPathException: Illegal char <:> at index 9: classpath:/test.sql
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:204) ~[na:na]
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:175) ~[na:na]
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) ~[na:na]
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92) ~[na:na]
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:231) ~[na:na]
at java.base/java.nio.file.Path.of(Path.java:148) ~[na:na]
at java.base/java.nio.file.Paths.get(Paths.java:69) ~[na:na]
at org.h2.store.fs.disk.FilePathDisk.getParent(FilePathDisk.java:340) ~[h2-2.3.232.jar:2.3.232]
at org.h2.store.fs.FileUtils.getParent(FileUtils.java:132) ~[h2-2.3.232.jar:2.3.232]
at org.h2.tools.RunScript.process(RunScript.java:186) ~[h2-2.3.232.jar:2.3.232]
at org.h2.tools.RunScript.process(RunScript.java:313) ~[h2-2.3.232.jar:2.3.232]
at org.h2.tools.RunScript.execute(RunScript.java:292) ~[h2-2.3.232.jar:2.3.232]
A sample app to reproduce the issue https://github.com/codecraft21/playground
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with org.h2.tools.RunScript.process, following the stack trace into org.h2.store.fs.FileUtils and FilePathDisk, to understand how the classpath:/test.sql input is converted into a Windows path. Reproduce the failure with the provided sample app and verify that RunScript.execute handles this classpath resource successfully on Windows without breaking the existing MacOS and Linux behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100