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

Michael B Allen ioplex at gmail.com
Tue Mar 17 01:34:55 GMT 2009

On Mon, Mar 16, 2009 at 8:59 PM,  <Matthew.Mortensen at ghd.com.au> wrote:
> 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 constructor does not throw an exception if the file cannot be
queried so I see nothing wrong with the above behavior.

> 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");

You can only set properties this way *before* JCIFS classes are
loaded. See the "Setting Client Properties" page for details. The best
way to be certain JCIFS properties are set is to use the
-Djcifs.properties option with a properties file.

> 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");

Again, the constructor doesn't thrown an exception unless the URL is
malformed so there's little point in trying to catch something
separately here.


Michael B Allen
Java Active Directory Integration

More information about the jcifs mailing list