[jcifs] Possible exists() solution

Michael B.Allen mballen at erols.com
Sat Dec 15 08:20:33 EST 2001


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?

-- 
May The Source be with you.




More information about the jcifs mailing list