Fix read beyond end of file

Addresses an infinite loop triggered by reading beyond
the end of the file.

Target: master, 1.2
Ticket: http://rt.dcache.org/Ticket/Display.html?id=8156
Patch: http://rb.dcache.org/r/6334/
Acked-by: Paul Millar <paul.millar@desy.de>
Merge branch 'fix/read-eof'
xrootd4j: Make errors null terminated

The spec states that the error string is null terminated. Also applies a
related optimization to the stat response code.

Target: trunk
Require-notes: yes
Require-book: no
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: http://rb.dcache.org/r/6543/
Merge commit '42101c68200e5c332c8cd4d2a470f907c0ea1b95'