[jcifs] File Lock issue

John Kudrle johnk at telestream.net
Tue Sep 10 09:34:42 EST 2002


	I was hoping someone could let me know if the following situation is
a bug (versus the intended effect) with the more recent releases of JCIFS.

	I am using JCIFS to enumerate a directory structure on a remote
machine and I am receive an exception if any of the files located in this
directory (on the remote machine) are in use by another process.

	The exception dump follows:

	jcifs.smb.SmbException: The file is being used by another process
	at jcifs.smb.SmbTransport.sendTransaction(SmbTransport.java:620)
	at jcifs.smb.SmbSession.sendTransaction(SmbSession.java:89)
	at jcifs.smb.SmbTree.sendTransaction(SmbTree.java:65)
	at jcifs.smb.SmbFile.sendTransaction(SmbFile.java:504)
	at jcifs.smb.SmbFile.queryPath(SmbFile.java:804)
	at jcifs.smb.SmbFile.exists(SmbFile.java:859)
	at jcifs.smb.SmbFile.isHidden(SmbFile.java:960)

	I have verified this behavior in jcifs-0.6.5 and jcifs-0.7.0.

	I saw that a situation very similar to this was noted and corrected
in jcifs-0.5b2.  I am running into this situation when I attempt to
enumerate the top level directory on a remote machine (on the remote server,
the C:\ drive is shared as the name "CDrive").   I am scanning through the
files in \\remoteMachine\CDrive and invoke the isHidden() method on them, I
eventually encounter the IO.sys file (it is residing on the main C partition
on the remote machine) which is of course in use by the operating system.
The isHidden() routine throws the above exception.

	Strangely enough, in the older version of JCIFS (jcifs 0.51), this
problem is not present.

	Below is a quick pseudo-code segment of what I am doing:

	jcifs.smb.SmbFile share = new jcifs.smb.SmbFile (url);
// url = address to remote share with appropriate credentials

	String[] list = share.list();

	for (int i=0; i< list.length; i++)
		jcifs.smb.SmbFile child = new jcifs.smb.SmbFile (url,

		if (child.isHidden() == true)

	The isHidden() call above is the call that is causing the exception
if the target file (in my case the IO.sys) is being used by another process.

-------------- next part --------------
HTML attachment scrubbed and removed

More information about the jcifs mailing list