dCache/jpnfs — pull request #8 by radai-rosenblatt (2014-09-09 08:17:45+00:00)
Title: fix NPE after READDIR in nfs3, enable console logging in dev/debug

as discussed in https://github.com/dCache/jpnfs/issues/5, there are 3 scenarios that result in an NPE in READDIR:

1. vfs implementation returns an empty list of directory entris (technically legal?)
2. client issue3 read request with very small "count" value, leaving not enough space for even a single entry
3. client attempts a 2nd read request using the cookie+verifier values from the last entry in a previous complete (eof=true) read request

this commit attempts to address all 3, complete with test cases. there are 2 significant changes:

1. execute the entry-list-writing code only if server intends to write actual entries (if startValue < dirList.size()) - this way res.resok.reply.entries is not initialized if no entries are to be written
2. when hitting the client-provided size limit, check to see if any entries have actually been written, and clear res.resok.reply.entries if not