[jcifs] Problem listing files from IBM iSeries server

Sai Pullabhotla sai.pullabhotla at jmethods.com
Fri Dec 17 12:19:47 MST 2010

I apologize if this message does not get associated with the correct
thread, but I just subscribed to the list and did not know how to
reply to an existing thread. Anyhow, this is regarding the issue with
duplicate file names being returned by the SmbFile.listFiles() method.
The original thread's subject is  "Problem listing files from IBM
iSeries server"

I briefly looked at the JCIFS code, and looked at the CIFS document,
and was able to fix the issue by doing the following:

The TRANS2_FIND_NEXT2 request is sent with all flags turned off. The
crucial flag appears to be the RESUME_FROM_PREVIOUS_END flag. Setting
this flag ensures that the next page (if any) starts at where it was
left off.

I did some basic tests and everything seems to be working. Not sure if
there was a reason for not setting this flag, but I want some one who
is more involved with the API to verify this.

I think we can also eliminate the SmbComFindClose2 request if we set
the FLAGS_CLOSE_IF_END_REACHED when sending the
TRANS2_FIND_FIRST2/NEXT2 requests. But this is not needed to fix the
issue in question.

I verified that this change still works good with different sizes set
on jcifs.smb.client.listCount config option.

Looking forward to get some feedback on this change.


More information about the jCIFS mailing list