This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | URLsAreEqualTest and similar fails on space in path | ||
---|---|---|---|
Product: | platform | Reporter: | Jaroslav Tulach <jtulach> |
Component: | Module System | Assignee: | Jaroslav Tulach <jtulach> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | jglick |
Priority: | P2 | Keywords: | SPACE_IN_PATH |
Version: | 7.0 | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
Jaroslav Tulach
2011-04-24 05:56:38 UTC
ergonomics#baccf434c55d Integrated into 'main-golden', will be available in build *201104260000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/baccf434c55d User: Jaroslav Tulach <jtulach@netbeans.org> Log: #198039: Convert '%20' to ' ' This does not look like a complete fix; you are only handling the special case of "%20", not other escapable characters. Demonstration: diff --git a/o.n.bootstrap/test/unit/src/org/netbeans/URLsAreEqualTest.java b/o.n.bootstrap/test/unit/src/org/netbeans/URLsAreEqualTest.java --- a/o.n.bootstrap/test/unit/src/org/netbeans/URLsAreEqualTest.java +++ b/o.n.bootstrap/test/unit/src/org/netbeans/URLsAreEqualTest.java @@ -64,7 +64,7 @@ } public void testURLsAreEqual() throws Exception { - final File wd = new File(getWorkDir(), "work dir"); + final File wd = new File(getWorkDir(), "work dir #1"); wd.mkdirs(); File jar = new File(wd, "default-package-resource.jar"); The following would work except possibly on UNC paths: diff --git a/o.n.bootstrap/src/org/netbeans/JarClassLoader.java b/o.n.bootstrap/src/org/netbeans/JarClassLoader.java --- a/o.n.bootstrap/src/org/netbeans/JarClassLoader.java +++ b/o.n.bootstrap/src/org/netbeans/JarClassLoader.java @@ -87,7 +87,6 @@ import java.util.logging.Logger; import java.util.zip.ZipEntry; import java.util.zip.ZipException; -import org.openide.util.Utilities; /** * A ProxyClassLoader capable of loading classes from a set of jar files @@ -848,14 +847,12 @@ if (bang == -1) { throw new IOException("Malformed JAR-protocol URL: " + u); } - int from; - if (url.startsWith("file:")) { - from = Utilities.isWindows() ? 6 : 5; - } else { - from = 0; + String jar; + try { + jar = new File(new URI(url.substring(0, bang))).getAbsolutePath(); + } catch (URISyntaxException x) { + throw new IOException(x); } - String jar = url.substring(from, bang).replace('/', File.separatorChar) - .replace("%20", " "); Source _src = Source.sources.get(jar); LOGGER.log(Level.FINER, "openConnection for {0} jar: {1} src: {2}", new Object[]{u, jar, _src}); if (_src == null) { Anyway this is not even a partial fix of bug #195730, which is about something different (handling of Class-Path headers). Thanks Jesse: ergonomics#0928450a313b Integrated into 'main-golden', will be available in build *201105030000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/0928450a313b User: Jaroslav Tulach <jtulach@netbeans.org> Log: #198039: Using URI to convert to File name. Thanks Jesse. |