[
https://issues.apache.org/jira/browse/JCLOUDS-874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14387538#comment-14387538
]
Andrew Gaul commented on JCLOUDS-874:
-------------------------------------
jclouds 1.8.1 did not have this sanity check and thus sent any sized hash code
to the server. 1.9.0 requires that the hash has only the 128 bits that MD5
specifies.
> IllegalArgumentException while setting incorrect MD5
> ----------------------------------------------------
>
> Key: JCLOUDS-874
> URL: https://issues.apache.org/jira/browse/JCLOUDS-874
> Project: jclouds
> Issue Type: Bug
> Components: jclouds-blobstore
> Affects Versions: 1.9.0
> Reporter: Shri Javadekar
> Assignee: Andrew Gaul
> Priority: Minor
>
> I had a negative test case that would set the incorrect md5 checksum of a
> blob. After upgrade to jclouds-1.9.0, this test fails with an
> IllegalArgumentException with a message that the md5 checksum should be 128
> bytes long but is 144 bytes.
> Here's the code for the test:
> {code:title=TestIncorrectMD5.java|borderStyle=solid}
> // Create a blob and set the incorrect md5 checksum
> public void testIncorrectMd5() throws Exception {
> {
> String blobName = "test";
> ByteSource input = ByteSource.wrap("testdata".getBytes(
> StandardCharsets.UTF_8));
> String fakeHash = "fakehash";
> byte[] blobHash = fakeHash.getBytes(Charsets.UTF_16);
> blobStore.blobBuilder(blobName)
> .payload(input)
> .contentLength(input.size())
> .contentMD5(HashCode.fromBytes(blobHash))
> .build();
> }
> {code}
> I wonder if computing of the HashCode has changed. If changed the fakeHash
> String from "fakehash" to "fakehas", the test worked fine.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)