[jcifs] Incorrect type set by listFiles()

dircha at bethel.edu dircha at bethel.edu
Fri Nov 15 18:23:12 EST 2002


I am encountering this error with both jcifs 0.7.0b7 and 0.7.0b8:
The value returned by jcifs.smb.SmbFile.getType() differs for an SmbFile object
returned from jcifs.smb.SmbFile.listFiles() and an SmbFile object constructed
with the same path as that returned in the results of listFiles().

Example:
"smb://BG/SharedDocs/"
Where "BG" is a computer on the network and "SharedDocs" is a share on "BG".

SmbFile file = new SmbFile("smb://BG/SharedDocs/");
file.getType() correctly reports the path as representing a type of TYPE_SHARE
file.listFiles() correctly gives me a list of folders on the share (which each
correctly have a type of TYPE_FILESYSTEM)

SmbFile file = new SmbFile("smb://BG/");
file.getType() correctly reports the path as representing TYPE_SERVER
SmbFile[] files = file.listFiles() is successful
files[2].getPath() correctly gives "smb://BG/SharedDocs/"
files[2].getType() INCORRECTLY gives TYPE_FILESYSTEM
files[2].listFiles() INCORRECTLY throws a jcifs.smb.SmbException with the
message "Invalid operation for IPC serviceInvalid operation for IPC service"

The workaround I have been using currently is to create new SmbFile objects with
the values returned by getPath() from the SmbFile objects returned by
listFiles(). This works.

Let me know if you want additional details, or if you want me to try other tests.

--Chad Dirks



More information about the jcifs mailing list