Skip to content

Commit 826c1cd

Browse files
committed
Avoid failures in SourceTest when filesystem does not support unicode paths
1 parent fbfb58e commit 826c1cd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/test/java/org/apache/calcite/util/SourceTest.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ void testAbsoluteFileToUrl(String path, String expectedUrl) throws URISyntaxExce
111111
URL url = of(absoluteFile).url();
112112

113113
assertNotNull(url, () -> "No URL generated for Sources.of(file(" + path + ").absoluteFile)");
114-
assertEquals(absoluteFile.getAbsolutePath(), Sources.of(url).file().getPath(),
114+
// Sources.of(url).file().getPath() does not always work
115+
// e.g. it might throw java.nio.file.InvalidPathException: Malformed input or input contains
116+
// unmappable characters: /home/.../ws/core/????????? ?????? ??????? ?????.txt
117+
// at java.base/sun.nio.fs.UnixPath.encode(UnixPath.java:145)
118+
assertEquals(absoluteFile.getAbsolutePath(), url.toURI().getSchemeSpecificPart(),
115119
() -> "Sources.of(Sources.of(file(" + path + ").absolutePath).url()).file().getPath()");
116120
}
117121

0 commit comments

Comments
 (0)