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.

Bug 31841

Summary: FileURL (& NbfsURLConnection) need to handle strange file characters better
Product: platform Reporter: Jesse Glick <jglick>
Component: FilesystemsAssignee: rmatous <rmatous>
Status: VERIFIED FIXED    
Severity: blocker CC: jtulach, pkuzel
Priority: P3 Keywords: SPACE_IN_PATH
Version: 3.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 39613    
Bug Blocks: 34317    

Description Jesse Glick 2003-03-10 20:41:35 UTC
Especially '#' in a path component of a FileObject
must be escaped and cannot be left as is in an
nbfs: URL. Looks like '#' in file system names are
escaped but not paths within a file system - with
core/localfs this will become more of a problem I
guess.

'?' is also a special character for URLs.
Comment 1 Jesse Glick 2003-03-10 20:44:02 UTC
Specifically, got on console:

URI
"nbfs:QBspaceQBsrc/ant/src/etc/testcases/core/include/frag#ment/include.inc"
has a fragment ID.

while doing a text search /space/src, which includes the subdir ant/
containing Apache Ant sources.
Comment 2 rmatous 2003-03-12 10:06:22 UTC
Do you think, that we need to keep strange escaping mechanism with 'Q'
prefix ? I would like to replace it with %xy pattern  which everybody
is familier with. I expect, that backward compatibility (decode) must
be kept, but encoding can be completely replaced. 
Comment 3 Jesse Glick 2003-03-12 14:54:43 UTC
Completely agreed.

One idea for how to make such a change compatible: move the name of
the file system into the 'host' part of the URL. That should be enough
to unambiguously distinguish old nbfs: URLs from the new. E.g.

nbfs://%2Fspace%2Fsrc%2Fnb_all%2Fcore%2Fsrc/org/netbeans/core/modules/package.html

Another possibility is to simply use a different URL protocol, e.g.

nbfile:/%2Fspace%2Fsrc%2Fnb_all%2Fcore%2Fsrc/org/netbeans/core/modules/package.html

Anyway getting rid of the weird Q-escapes would be very nice.
Comment 4 rmatous 2003-06-09 13:21:10 UTC
Fixed in trunk.

/cvs/openide/execution/src/org/openide/execution/NbfsURLConnection.java,v
 <--
NbfsURLConnection.java
new revision: 1.5; previous revision: 1.4

/cvs/openide/src/org/openide/filesystems/FileURL.java,v  <--  FileURL.java
new revision: 1.19; previous revision: 1.18

/cvs/openide/src/org/openide/filesystems/NbfsUtil.java,v  <-- 
NbfsUtil.java
initial revision: 1.1
Comment 5 Jaroslav Tulach 2003-06-09 14:26:52 UTC
I would be valuable to add also some test cases. I'd bet you had some
anyway to test the behaviour, so just turn them into NbTestCase please.
Comment 6 rmatous 2003-06-10 14:32:35 UTC
Test added. 

/cvs/openide/test/unit/src/org/openide/filesystems/FileObjectTestHid.java,v
 <--
  FileObjectTestHid.java
new revision: 1.15; previous revision: 1.14
Comment 7 Jaroslav Tulach 2003-06-10 16:13:15 UTC
A test is there and seems to call decode & encode URL methods.
Comment 8 _ pkuzel 2003-06-25 17:03:16 UTC
Is <nbfs://%2Fhome%2Fpk97937%2Fbugs/is34/x317/emptyDTD.dtd> valid URL?
Parser denies to accept it. Original nbfs coding scheme used Q escaping.

I cannot render the specification
<http://www.ietf.org/rfc/rfc2396.txt>. So I tried Mozilla and it also
denies URLs that contain escaping in host name. Escaping is OK in path.

Please resolve soon as issue 34317 is Q-build blocker.
Comment 9 _ pkuzel 2003-06-25 17:30:00 UTC
Appendix A reads:

      hostname      = *( domainlabel "." ) toplabel [ "." ]
      domainlabel   = alphanum | alphanum *( alphanum | "-" ) alphanum
      toplabel      = alpha | alpha *( alphanum | "-" ) alphanum

So really escaped is not allowed in host name.
Comment 10 Jiri Kovalsky 2003-06-27 09:47:04 UTC
Could somebody please do something about it ? This bug prevents issue
#34317 to be fixed and thus takes over its Q-build showstopper
attribute ! Increasing prirority ...
Comment 11 rmatous 2003-06-27 11:54:52 UTC
Fixed in trunk:

/cvs/openide/src/org/openide/filesystems/NbfsUtil.java,v  <-- 
NbfsUtil.java
new revision: 1.2; previous revision: 1.1

and also in QBE200306250100:

/cvs/openide/src/org/openide/filesystems/NbfsUtil.java,v  <-- 
NbfsUtil.java
new revision: 1.1.8.1; previous revision: 1.1
Comment 12 dmladek 2003-06-27 16:31:39 UTC
I'm verifying it because fix is solving performance problem
mentioned in the issue #34456

Maybe that issue is duplicate of this one...
Comment 13 Martin Schovanek 2003-06-30 10:28:32 UTC
Verified, the fix is solving problem mentioned in the issue #34317.