> +
> +   public AWSRequestSignerV4(String identity, String credential, Crypto 
> crypto) {
> +      this.crypto = checkNotNull(crypto);
> +      this.identity = checkNotNull(identity);
> +      this.credential = checkNotNull(credential);
> +   }
> +
> +   private String buildHashedCanonicalRequest(String method, String 
> endpoint, String hashedPayload,
> +         String canonicalizedHeadersString, String signedHeaders) {
> +      StringBuilder buffer = new StringBuilder();
> +      buffer.append(method).append("\n");
> +      buffer.append(endpoint).append("\n");
> +      buffer.append("").append("\n");
> +      buffer.append(canonicalizedHeadersString).append("\n");
> +      buffer.append(signedHeaders).append("\n");
> +      buffer.append(hashedPayload);

You can write this in a more compact form by reusing the return value of 
```StringBuffer``` methods, e.g.,

```
String string = new StringBuffer()
    .append(method).append("\n")
    .append(endpoint).append("\n")
    ...
    .build()
```

And actually this is equivalent to just using + for concatenation.

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

Reply via email to