[ 
https://issues.apache.org/jira/browse/JCLOUDS-874?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shri Javadekar updated JCLOUDS-874:
-----------------------------------
    Description: 
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.

  was:
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 checksump
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.


> 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
>            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)

Reply via email to