[jcifs] smbfolder.listFiles(SmbFileFilter) drops folders with a leading whitespace

Michael B Allen ioplex at gmail.com
Mon Aug 2 11:46:20 MDT 2010


Hi Craig,

Ok. Thanks for the followup.

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/

On Sat, Jul 31, 2010 at 11:25 AM, Craig Stires <craig.stires at gmail.com> wrote:
>
>
> mike, this can be scratched from the todo list
>
>
>
> updating on this again.  i am back working at the site where there are a
> number of files and folders with leading whitespaces
>
>
>
> my initial guess that spaces were being trimmed in jcifs code was wrong.
>
> the problem lies with the java.net.URL constructor.  it gets rid of leading
> and trailing whitespace
>
>
>
> java.net.URL  (lines: 506-512)
>
> ---------------
>
>    limit = spec.length();
>
>    while ((limit > 0) && (spec.charAt(limit - 1) <= ' ')) {
>
>       limit--;   //eliminate trailing whitespace
>
>    }
>
>    while ((start < limit) && (spec.charAt(start) <= ' ')) {
>
>       start++;   // eliminate leading whitespace
>
>    }
>
> ---------------
>
>
>
> so, short of modifying the code for URL or patching the code at SmbFile
> (line 620), where the URL is instantiated, i'm not sure any other path
>
>
>
> if anyone has a suggestion, i'd most appreciate it
>
>
>
> -craig
>
>
>
>
>
> From: Craig Stires [mailto:craig.stires at gmail.com]
> Sent: Friday, 4 June 2010 10:59 PM
> To: 'jcifs at lists.samba.org'
> Subject: smbfolder.listFiles(SmbFileFilter) drops folders with a leading
> whitespace
>
>
>
>
>
> wanted to followup with an update on an issue i had found in January.
> hopefully, this will help isolate the problem
>
>
>
> I'm using jcifs 1.3.14
>
>
>
> The problem happens whenever a folder name starts with a ' '.  When
> smbfolder.listFiles(SmbFileFilter) is called on a folder containing
> subfolders with leading spaces, the SmbFile[] list returned has the leading
> space stripped off.
>
>
>
> e.g.
>
> actual   >  smb://mysrv/user/c/ foldername/
>
> returned >  smb://mysrv/user/c/foldername/
>
>
>
> I traced it down through the send stack
>
> (SmbFile.send(ServerMessageBlock request, ServerMessageBlock response)
>
> -> SmbTransport.send(request, response)
>
>
>
> beyond that, i think it may be caused by a String.trim() further on in this
> code
>
> (Handler.java > getDefaultStreamHandler : 114)
>
>    String provider = tokenizer.nextToken().trim();   // Does this need to be
> trimmed?
>
>
>
> other files that have a call to trim, but i'm not sure are relevant to this
>
>    src/jcifs/dcerpc/Dcerpc/DcerpcHandle > parseBinding : 72,82,85
>
>    src/jcifs/UniAddress > constructor : 95
>
>    src/jcifs/http/NtlmHttpURLConnection > attemptNegotiation : 511,520
>
>    src/jcifs/netbios/NameServiceClient > constructor : 107
>
>    src/jcifs/netbios/Lmhosts > populate : 86,109
>
>
>
>


More information about the jCIFS mailing list