> +            continue;
> +         String key = 
> header.getKey().toString().toLowerCase(Locale.getDefault());
> +         // Ignore any headers that are not particularly interesting.
> +         if (key.equalsIgnoreCase(HttpHeaders.CONTENT_TYPE) || 
> key.equalsIgnoreCase("Content-MD5")
> +               || key.equalsIgnoreCase(HttpHeaders.HOST) || 
> key.startsWith(HEADER_TAG)) {
> +            canonicalizedHeaders.put(key, header.getValue());
> +         }
> +      }
> +      return canonicalizedHeaders;
> +   }
> +
> +   private String buildCanonicalizedHeadersString(Multimap<String, String> 
> canonicalizedHeadersMap) {
> +      StringBuilder canonicalizedHeadersBuffer = new StringBuilder();
> +      for (Entry<String, String> header : canonicalizedHeadersMap.entries()) 
> {
> +         String key = header.getKey();
> +         canonicalizedHeadersBuffer.append(String.format("%s:%s\n", 
> key.toLowerCase(), header.getValue()));

Kind of an anti-pattern here, this compiles into another StringBuffer 
allocation.  Instead:

```
canonicalizedHeadersBuffer.append(key.toLowerCase())
    .append(':').append(header.getValue()).append('\n');
```

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

Reply via email to