Over on TIKA-2873, we were just hit with this. In ChunkedCipherInputStream, read() is guaranteed to return -1 if there was something in the stream: @Override public int read() throws IOException { byte[] b = \{ 0 }; // FIXME: compare against -1 or 1? (bug 59893) return (read(b) == 1) ? -1 : b[0]; } This is related to 59893...and probably should be: @Override public int read() throws IOException { byte[] b = \{ 0 }; // FIXME: compare against -1 or 1? (bug 59893) return (read(b) == -1) ? -1 : b[0]; } I just made the change and all tests pass...any reason not to fix this?
Definitely looks like a bug to me. +1 for merging.
Although ChunkedCipherInputStream::read(byte[], int, int, boolean) returns -1, if no more data can be fetched and so there's no result size of 0, I would rewrite the original code: if (read(b) == 1) { return b[0]; } return -1; to: return (read(b) == 1) ? b[0] : -1;
r1859251 Thank you, Andi...I was wondering about that.