[jcifs] Possible exists() solution

Rob Wygand rob at wygand.com
Sat Dec 15 10:48:33 EST 2001


Mike,

I just tried this, and while it looks like a good fix, I'm still seeing 
erronerous false results on canRead. However, I'm curious to see what 
others see, as I haven't done any extensive testing with this patch...

rjw

Michael B.Allen wrote:

> In jcifs/smb/SmbURL.java make the analygous code look like:
> 
> if( end > beg ) { 
>     while( end > beg && url.charAt( end - 1 ) == '/' ) { 
>         end--; // trim trailing slashes 
>     }
>     while( beg < end && url.charAt( beg ) != '/' && url.charAt( beg ) != '@' ) { 
>         beg++;
>     }
>     if( beg == end && Character.isDigit( url.charAt( start + 2 )) == false ) {
>         int type;
>         Object addr;
> 
>         // Could be a workgroup. Need to query the network to find out.
>         file.address = UniAddress.getByName( url.substring( 6, end ), true ); 
>         addr = file.address.getAddress();
>         if( addr instanceof NbtAddress ) {
>             type = ((NbtAddress)addr).getNameType();
>             if( type == 0x1d || type == 0x1b ) {
>                 if( name != null ) {
>                     url = "smb://" + name; 
>                     name = null; 
>                     start = 4;
>                     limit = url.length();
>                 } else {
>                     file.isWorkgroup = true; 
>                 }       
>             }       
>         }       
>     }       
> }
> 
> Does this fix the exists/canRead problem?
> 
> 






More information about the jcifs mailing list