[jcifs] getName weirdness...

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Tue Feb 5 14:08:51 EST 2002


> -----Original Message-----
> From:	rjw [SMTP:rob at wygand.com]
> Really? That's very odd... I'm using an unadulterated jCIFS dist. Hm. 
> Two things.. (1) I may only be seeing against Samba, and (2) here's my 
> test proggie:
	<snip>
> >>
> >>Mike,
> >>
> >>If you attempt to list the shares on a server without a trailing slash 
> >>on the URL ("smb://10.1.3.1" vs. "smb://10.1.3.1/"), jCIFS returns 
> >>everything after the "smb://" as the name name of the requested file 
> >>when you call getName().
> 
	This one liner should fix it I think.

	--- jcifs_0.6b8.orig/src/jcifs/smb/SmbURL.java  Sat Jan 12 16:37:39 2002
	+++ jcifs_0.6b8/src/jcifs/smb/SmbURL.java   Mon Feb  4 21:55:05 2002
	@@ -64,6 +64,7 @@
	                while( end > beg && url.charAt( end - 1 ) == '/' ) { 
	                    end--; // trim trailing slashes 
	                }
	+               url = url.substring( 0, end );
	                while( beg < end && url.charAt( beg ) != '/' && url.charAt( beg ) != '@' ) { 
	                    beg++;
	                }






More information about the jcifs mailing list