> +      // Request an upload site for this file
> +      UploadSandbox site = 
> api.createUploadSandboxForChecksums(ImmutableSet.of(md5));
> +      assertTrue(site.getChecksums().containsKey(md5), md5 + " not in " + 
> site.getChecksums());
> +
> +      try {
> +         // Upload the file contents, if still not uploaded
> +         ChecksumStatus status = site.getChecksums().get(md5);
> +         if (status.needsUpload()) {
> +            api.uploadContent(status.getUrl(), content);
> +         }
> +         Sandbox sandbox = api.commitSandbox(site.getSandboxId(), true);
> +         assertTrue(sandbox.isCompleted(), "Sandbox should be completed 
> after uploading");
> +      } catch (RuntimeException e) {
> +         api.commitSandbox(site.getSandboxId(), false);
> +         fail("Could not upload content");
> +         return null;

The `fail` method will already throw an exception, so there is no need to 
return null here. This is unreachable code.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/32/files#r7272837

Reply via email to