[jcifs] NPE when trying to listFiles on SmbFile object

Michael B Allen ioplex at gmail.com
Tue Aug 4 12:42:50 MDT 2009


On Tue, Aug 4, 2009 at 3:22 AM, Jano Peti<jano.peti at gmail.com> wrote:
> Hello,
> maybe I did not configure all stuff properly,
> but I look to examples and I think
> I am doing it right.
> I trying to connect to a remote disk which
> runs on windows server.
>
> NtlmPasswordAuthentication ntlmauth = new
> NtlmPasswordAuthentication("GROUP","LOGIN","PASSWORD");
> SmbFile smb = new SmbFile("smb://path/",ntlmauth);
> SmbFile[] files = smb.listFiles();<-- I get here NPE:
>
> String domain = dr.server.toLowerCase(); <-- dr is null
>
> java.lang.NullPointerException
> at jcifs.smb.Dfs.getTrustedDomains(Dfs.java:69)
> at jcifs.smb.Dfs.resolve(Dfs.java:165)
> at jcifs.smb.SmbFile.doConnect(SmbFile.java:890)

Hi Jano,

That's definitely a bug. Try this package:

  http://207.192.69.113/~miallen/jcifs-1.3.12c.jar
  http://207.192.69.113/~miallen/jcifs-1.3.12c.zip
  http://207.192.69.113/~miallen/jcifs-1.3.12c.tgz

I suspect you don't have domain-based DFS so getTrustedDomains is
returning null. I just needed to add a little clause to check for
that.

Let me know how it goes either way so that I can push this out to the public.

Thanks,
Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/


More information about the jcifs mailing list