[jcifs] jcifs eats InterruptedException

Igor Golikov igolikov at gmail.com
Fri Feb 6 01:23:02 MST 2015


Hi all,

I found that it is impossible to interrupt thread that performs some
operations using jcifs.

Here is an example

    java.lang.Object.wait(Object.java:-2)
    java.lang.Object.wait(Object.java:503)
    jcifs.UniAddress.lookupServerOrWorkgroup(UniAddress.java:176)
<----------- part A
    jcifs.UniAddress.getAllByName(UniAddress.java:290)
    jcifs.UniAddress.getByName(UniAddress.java:245) <----------- part B
    jcifs.smb.Dfs.getTrustedDomains(Dfs.java:62)
    jcifs.smb.Dfs.resolve(Dfs.java:167)
    jcifs.smb.SmbFile.doConnect(SmbFile.java:902)
    jcifs.smb.SmbFile.connect(SmbFile.java:954)
    jcifs.smb.SmbFile.connect0(SmbFile.java:880)
    jcifs.smb.SmbFile.open0(SmbFile.java:972)
    jcifs.smb.SmbFile.open(SmbFile.java:1006)
    jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:142)
    jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:97)
    jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:67)


Part A - replacing InterruptedException with UnknownHostException
============================================
...
} catch( InterruptedException ie ) {
    throw new UnknownHostException( name );
}
...


Part B - hiding UnknownHostException
============================================
...
} catch (IOException ioe) {
    if (log.level >= 3)
        ioe.printStackTrace(log);
    if (strictView && ioe instanceof SmbAuthException) {
        throw (SmbAuthException)ioe;
    }
}
...


Why it hides InterruptedException?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20150206/50536108/attachment.html>


More information about the jCIFS mailing list