Re: file name is not correct
Michael B Allen <[email protected]>
| Newsgroups | gmane.network.samba.java |
|---|---|
| Message-ID | <CAGMFw4griKwsh-+PZo5XChLkJP0+VBo0VPeBFED-DfuW66b1gg@mail.gmail.com> |
On Mon, Aug 15, 2011 at 4:59 PM, Sebastian Sickelmann <[email protected]> wrote: > Am 14.08.2011 05:19, schrieb Michael B Allen: >> >> 2011/8/13<[email protected]>: >>> >>> Hi, Mike, >>> >>>> Try the URL escape sequence for space which is %20 like: >>> >>> If I create SmbFile object from file name, It is OK. >>> But I want to create SmbFile object from directory. >>> 1. SmbFile dir = SmbFile("smb://host/dir/", auth); >>> 2. SmbFile[] fileList = dir.listFiles(); >>> 3. execute getName, getUncPath ant getPath for each file got from >>> fileList. >>> 4. then, I receive file name without space. >> >> Hi Dora, >> >> I believe this is occurring because of the java.net.URL class which is >> used internally to manipulate URLs. So it cannot handle some special >> characters in special instances. Meaning the java.net.URL class is >> trimming leading spaces from the filename. Unfortunately unless we >> re-write JCIFS to not use the java.net.URL class, there is not a whole >> lot we can do about this. >> >> Mike >> > Hi, > > Because the URL is following the recommendations in RFC2396 it tolerates > spaces in urls and removes them. If i understand the RFC correct it is to > make it easier for people to type in urls by hand. > Prefixing "URL:" solves it in at least for the jdk interpretation of > rfc2396. > > So the attached patch fix it for me. Hi Sebastian, That is an interesting patch. I have added it to the TODO list for further investigation at a later time. Thanks for the feedback. Mike -- Michael B Allen Java Active Directory Integration http://www.ioplex.com/