> +      }
> +      int b = currentChunk.getData()[bytesRead] & 0xff;
> +      bytesRead = bytesRead + 1;
> +      if (bytesRead >= currentChunk.getSize()) {
> +         readNextChunk();
> +      }
> +      return b;
> +   }
> +
> +   private boolean hasFinished() {
> +      return chunks.size() == 0 && bytesRead >= currentChunk.getSize();
> +   }
> +
> +   private void readNextChunk() {
> +      if (chunks.size() > 0) {
> +         this.currentChunk = jdbcService.findChunkById(chunks.get(0));

It this method returns `null`, the `hasFinished` will throw a NPE, and a NPE 
thrown from inside the `read` method of an InputStream is bad.

Fix the methods in this class so the `read` method only throws appropriate 
`IOExceptions`. Also add a unit test for this class that exercises the edge 
cases such as an empty initial chunk list, a null list (which is now allowed) 
an initial list with invalid IDs, etc.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/176/files#r32199119

Reply via email to