[jcifs] spaces in a network share

Michael B Allen ioplex at gmail.com
Sat Mar 6 22:59:27 MST 2010

On Fri, Mar 5, 2010 at 9:16 AM, Bogguard <bogguard at gmail.com> wrote:
> Hi,
> What character does a space needs to be replaced with to work in a share name?
> I tried the following but always got the following respond :
> -> The network name cannot be found.
> I tried the following (share name = test name)
> - test%20name

Hi Bogguard,

It should be your first example with %20 URL encoding. This is because
the SmbFile class extends URLConnection and thus the java.net.URL
class is used to do the primary URL parsing (although note that the
share is actually part of the URL path). I don't recall if the URL
class actually URL decodes the path. If it does, your %20 example
should work I think. If it does not, you could get a packet capture to
confirm that the %20 is actually being sent to the server instead of a
space. If that is in fact what is happening, unfortunately it will be
awkward to fix the problem because we are somewhat at the mercy of the
what the URL class is doing. In fact I recall this issue has come up
in the past and the fact that it has persisted to now inclines me to
think that the old java.net.URL class is at the source of the issue.
In the future it might be important to move to the java.net.URI class
(I instead of L).


Michael B Allen
Java Active Directory Integration

More information about the jCIFS mailing list