You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2026/10/03 08:20:07 UTC
(openoffice) 02/03: Tests for: accept local files
This is an automated email from the ASF dual-hosted git repository.
ardovm pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 7456e17c83b8fcc5806811ffdb156c6b3daf5785
Author: Peter <pe...@apache.org>
AuthorDate: Sat Sep 26 22:16:30 2026 +0200
Tests for: accept local files
Co-Authored-By: Claude Opus 5.5 <no...@anthropic.com>
(cherry picked from commit 6af66d39c39162852c7402525ae40100cf9acca9)
---
main/connectivity/qa/complex/sdbc/ToolsTest.java | 45 ++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/main/connectivity/qa/complex/sdbc/ToolsTest.java b/main/connectivity/qa/complex/sdbc/ToolsTest.java
index 3e5d1a9f85..ed0b6720a9 100644
--- a/main/connectivity/qa/complex/sdbc/ToolsTest.java
+++ b/main/connectivity/qa/complex/sdbc/ToolsTest.java
@@ -108,6 +108,51 @@ public final class ToolsTest {
assertTrue(collect("jar:wibble:/opt/a.jar!/").isEmpty());
}
+ @Test
+ public void testAddClassPathURLAddsLocalhostAndEscapedLocalFile() {
+ assertEquals(1, collect("file://localhost/opt/a.jar").size());
+ assertEquals(1, collect("file:///opt/Program%20Files/a.jar").size());
+ assertEquals(1, collect("file:///opt/a%2Fb/c.jar").size());
+ // One level of decoding only: this names a file called "%5C%5Chost".
+ assertEquals(1, collect("file:///opt/%255C%255Chost/a.jar").size());
+ }
+
+ @Test
+ public void testAddClassPathURLSkipsFileOnAnotherHost() {
+ assertTrue(collect(
+ "file://host/share/a.jar",
+ "file://wsl.localhost/distro/a.jar",
+ "jar:file://host/share/b.jar!/").isEmpty());
+ }
+
+ @Test
+ public void testAddClassPathURLSkipsPathNamingAnotherHost() {
+ assertTrue(collect(
+ "file:////host/share/a.jar",
+ "file://localhost//host/share/b.jar",
+ "jar:file:////host/share/c.jar!/").isEmpty());
+ }
+
+ @Test
+ public void testAddClassPathURLSkipsEscapedSeparatorNamingAnotherHost() {
+ // The file: handler decodes the path and, on Windows, turns slashes
+ // into backslashes, so each of these would be opened as \\host\share.
+ assertTrue(collect(
+ "file:///%5C%5Chost/share/a.jar",
+ "file:///%5c%5chost/share/b.jar",
+ "file:///%2F%2Fhost/share/c.jar",
+ "file:/%2Fhost/share/d.jar",
+ "file://localhost/%5C%5Chost/share/e.jar",
+ "jar:file:///%5C%5Chost/share/f.jar!/").isEmpty());
+ }
+
+ @Test
+ public void testAddClassPathURLSkipsBackslash() {
+ assertTrue(collect(
+ "file:\\\\host\\share\\a.jar",
+ "file:///C:%5C..%5Cb.jar").isEmpty());
+ }
+
@Test
public void testAddClassPathURLKeepsOnlyLocalEntriesInOrder() {
List<URL> urls = collect(