> + byte[] buffer = new byte[JdbcConstants.DEFAULT_CHUNK_SIZE];
> + while ((bytes = data.read(buffer, 0,
> JdbcConstants.DEFAULT_CHUNK_SIZE)) != -1) {
> + chunks.add(chunkRepository.create(new ChunkEntity(buffer,
> bytes)).getId());
> + buffer = new byte[JdbcConstants.DEFAULT_CHUNK_SIZE];
> + }
> + data.close();
> + return chunks.build();
> + }
> +
> + private void checkIntegrity(Blob blob, BlobEntity entity) throws
> IOException {
> + HashCode hash =
> blob.getMetadata().getContentMetadata().getContentMD5AsHashCode();
> + if (hash != null) {
> + HashingInputStream his = new HashingInputStream(Hashing.md5(), new
> JdbcInputStream(this, entity.getPayload().getChunks()));
> + HashCode actualHash = his.hash();
> + if (hash.equals(actualHash)) {
> + throw new IOException("MD5 hash code mismatch");
Would be more appropriate to throw an IllegalStateException here?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/176/files#r32198210