[jcifs] NullPointerException at listFiles

Michael B Allen ioplex at gmail.com
Thu May 8 01:49:07 MDT 2014

On Tue, Mar 4, 2014 at 6:21 AM,
<masakazu.matsuura.fy at hitachi-solutions.com> wrote:
> Hi All,
> We encountered the same problem as Dora reported.
> https://lists.samba.org/archive/jcifs/2012-January/009856.html
> Then we used JCIFS-1.3.18b.
> http://jcifs.samba.org/jcifs-1.3.18b.jar
> However this patch does not help us.
> Any ideas?

Hi Masakazu,

This is not unlike NPEs also reported by Brett Johnson Oct 15, 2012
and Gabor Herr Mar 4, 2012. It seems this bit of code:

        DfsReferral dr = dfs.resolve(

has a tendency for tree.session.transport.tconHostName to be null. But
I have no idea why at this point. My guess is there's some kind of
race where the transport is really not open even though connect0() is
called successfully. Some kind of race I suppose. This is already on
the TODO list. Unfortunately this looks like it will be quite
difficult to replicate.


Michael B Allen
Java Active Directory Integration

> <environment>
> JCIFS : 1.3.18b
> Network access : using DFS
> <stacktrace>
> Caused by: java.lang.NullPointerException
>  at jcifs.smb.Dfs.resolve(Dfs.java:169)
>  at jcifs.smb.SmbFile.resolveDfs(SmbFile.java:671)
>  at jcifs.smb.SmbFile.send(SmbFile.java:773)
>  at jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1989)
>  at jcifs.smb.SmbFile.doEnum(SmbFile.java:1741)
>  at jcifs.smb.SmbFile.listFiles(SmbFile.java:1718)
>  at jcifs.smb.SmbFile.listFiles(SmbFile.java:1707)
> ----
> Thanks and Regards,
> Masakazu Matsuura

More information about the jCIFS mailing list