[jcifs] SmbFile.listFiles returning too low number of files

Michael B Allen ioplex at gmail.com
Thu Apr 14 18:24:22 MDT 2011

On Tue, Apr 12, 2011 at 3:29 PM, Volker Schmelich <volker at quadnova.com> wrote:
> Hi there,
> We experience a strange issue on one of our Windows PCs with jCIFS
> 1.3.14 and 1.3.15. The Windows PC is running Windows 7 Home Premium x64
> with SP1. We use JDK 1.6.0_24 both 32 bit and 64 bit.
> When we call SmbFile.listFiles(), the method does not return all files
> available in the directory. E.g. we have 1146 files in there, but the
> method returns 1094 and sometimes 1127 (when we let it run in a loop
> with 1s delay).
> The bug is reproducible on this one PC every time we use more than about
> 200 files. It works fine on one of our Windows 2000 and one of our 2003
> servers and other Windows 7 PCs, too.
> This Java snippet is as simple as it gets to reproduce it:
> String sourceDir =
> "file://tempshare:tempshare@vs-cyberpower/dceinshare/test2/";
> SmbFile src = new SmbFile(sourceDir);
> SmbFile[] list = src.listFiles();
> int cnt1 = list.length;
> As copyTo depends on listFiles, copying all the files in the directory
> does not copy all of them, only those returned by listFiles.
> There are no exceptions, no stack traces. The example above uses the
> plain JAR file, no extra jCFIS configurations.
> We also tried jcifs.smb.client.attrExpirationPeriod = 0 with no
> difference.
> Is there any direction you could point us - we tried to figure it out
> for hours but we are lost.

Hi Volker,

Try the fully qualified DNS hostname. And for testing it might be
better to use the IP address. Also, supply the credentials to SmbFile
using an NtlmPasswordAuthentication object. If that changes the
result, we will have a better idea of what the problem is. If that
does not change the behavior, can you get a packet capture?


Michael B Allen
Java Active Directory Integration

More information about the jCIFS mailing list