You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Andrew Phillips <no...@github.com> on 2014/08/11 14:23:34 UTC

[jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

See JCLOUDS-622 and https://github.com/jclouds/jclouds/commit/80a0256c
You can merge this Pull Request by running:

  git pull https://github.com/jclouds/jclouds-chef fix-build

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds-chef/pull/49

-- Commit Summary --

  * Fixing compilation errors caused by Payload no longer being an InputSupplier

-- File Changes --

    M core/src/main/java/org/jclouds/chef/filters/SignedHeaderAuth.java (2)
    M core/src/main/java/org/jclouds/chef/internal/BaseChefService.java (4)

-- Patch Links --

https://github.com/jclouds/jclouds-chef/pull/49.patch
https://github.com/jclouds/jclouds-chef/pull/49.diff

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

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by Andrew Gaul <no...@github.com>.
@demobox I used this for fb60d76704745317186ad700e9b7ce5a569a614d:

```
JCLOUDS-622: Remove most vestiges of InputSupplier
    
Guava 16 deprecated InputSupplier and a future release will remove it.
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51831012

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by Andrew Phillips <no...@github.com>.
> I used this

Ah, you're referring to the "adding .openStream()" bit rather than the "ByteStreams2" bit. Makes sense!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51835968

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-chef-pull-requests #119](https://jclouds.ci.cloudbees.com/job/jclouds-chef-pull-requests/119/) FAILURE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51773206

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-chef #1271](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-chef/1271/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51780609

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by Andrew Phillips <no...@github.com>.
>     }
>  
>     @Override
>     public byte[] decrypt(InputSupplier<? extends InputStream> supplier) throws IOException {
>        return ByteStreams.toByteArray(new RSADecryptingPayload(crypto, Payloads.newPayload(supplier.getInput()), privateKey
> -                  .get()));
> +                  .get()).openStream());

See above comment about the need to close the stream.

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

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by Andrew Phillips <no...@github.com>.
Closed #49.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#event-151552594

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-chef-pull-requests #121](https://jclouds.ci.cloudbees.com/job/jclouds-chef-pull-requests/121/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51823974

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by Andrew Phillips <no...@github.com>.
Committed to [master](https://git-wip-us.apache.org/repos/asf?p=jclouds-chef.git;a=commit;h=973c31e3944f3b728afd10b3a9a47fbb3cf7006f)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51830239

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by Andrew Phillips <no...@github.com>.
> @@ -190,7 +190,7 @@ public boolean apply(Part input) {
>  
>     public String sign(String toSign) {
>        try {
> -         byte[] encrypted = toByteArray(new RSAEncryptingPayload(crypto, Payloads.newStringPayload(toSign), supplyKey.get()));
> +         byte[] encrypted = toByteArray(new RSAEncryptingPayload(crypto, Payloads.newStringPayload(toSign), supplyKey.get()).openStream());

Does this stream need to be closed in a `finally`? The Guava doc explicitly states that [toByteArray](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/io/ByteStreams.html#toByteArray\(java.io.InputStream\)) will **not** close the stream.

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

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by Andrew Gaul <no...@github.com>.
> @@ -190,7 +190,7 @@ public boolean apply(Part input) {
>  
>     public String sign(String toSign) {
>        try {
> -         byte[] encrypted = toByteArray(new RSAEncryptingPayload(crypto, Payloads.newStringPayload(toSign), supplyKey.get()));
> +         byte[] encrypted = toByteArray(new RSAEncryptingPayload(crypto, Payloads.newStringPayload(toSign), supplyKey.get()).openStream());

We should close it for consistency, although `StringPayload.openStream` returns a `ByteArrayInputStream` and thus does not require `close`.  Please use `ByteStreams2.toByteArrayAndClose`.

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

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by Andrew Phillips <no...@github.com>.
@andrewgaul @nacx Thoughts on the stream closing question?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51773076

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by Andrew Phillips <no...@github.com>.
> backport to 1.8.x since this may allow users to upgrade their applications to Guava 18

What should I put in the commit message? What's incompatible with other versions of Guava?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51830400

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-chef #1273](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-chef/1273/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51823872

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by Andrew Gaul <no...@github.com>.
:+1: Thanks for catching this and please backport to 1.8.x since this may allow users to upgrade their applications to Guava 18.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51823148

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-chef-pull-requests #120](https://jclouds.ci.cloudbees.com/job/jclouds-chef-pull-requests/120/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51780636

Re: [jclouds-chef] Fixing compilation errors caused by Payload no longer being an InputSupplier (#49)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-chef #1269](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-chef/1269/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-chef/pull/49#issuecomment-51773122