[jcifs] Question about debugging a failed smbFile.exists() call

Matthew.Mortensen at ghd.com.au Matthew.Mortensen at ghd.com.au
Tue Mar 17 00:59:00 GMT 2009


I use the section of code included at the bottom of this email to connect 
to a file using an SMB Url
eg.  smb://ghdnet.internal/ghd/AU/Brisbane/Archive-New/41/16255/WP/Final 
Report/GHD Mary River Diversion Channel Final Report 370123.pdf
There's no error on f1 = SmbFile(local), but when I call f1.exists() it 
returns false.
The same code works for the majority of files on the network and only 
fails for a few.  I can't work out why.  I know it could probably be many 
reasons but I'm not sure how I get some more logging information here as 
there is no exception raised.
I've set the loglevel in my Config
Config.setProperty("jcifs.util.loglevel", "8");
Just looking for some suggestions on how I could start debugging this 
case.  Thanks

SmbFile f1 = null;
try {
        f1 = new SmbFile(local);
} catch (Exception e) {
        System.out.println("Trying to catch failed new SMBFile");
        e.printStackTrace();
}
target ="";
//Check if file exists then transfer to FTP server
//Special try statement in case file permissions don't allow access
try { 
        if( f1.exists() ) {
        target = f1.getName();
        System.out.println( local + " exists" );
        in = new BufferedInputStream(new SmbFileInputStream(f1));  
        ftp.setFileType(ftp.BINARY_FILE_TYPE);
        System.out.println("FTP of file beginning.... "); 
        ftp.storeFile(target, in);
        in.close(); 
} else {
        System.out.println( local + " does not exist.  Skip this transfer" 
);
        reportDoc.replaceItemValue("ErrorCause","File not found : 
"+local);
        reportDoc.replaceItemValue("Error","True");  
}

Matthew Mortensen


_____________________ 
This email and all attachments are confidential. For further important information about emails sent to or from GHD or if you have received this email in error, please refer to http://www.ghd.com.au/emaildisclaimer.html
_____________________ 
This e-mail has been scanned for viruses by MessageLabs.
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list