You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Aled Sage <no...@github.com> on 2014/07/17 18:04:05 UTC

[jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

jclouds-labs master is broken, e.g. see https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/209/org.apache.jclouds.labs$docker/console which reports the error:

    [ERROR] /scratch/jenkins/workspace/jclouds-labs-pull-requests/docker/src/main/java/org/jclouds/docker/handlers/DockerErrorHandler.java:[95,25] toString() in java.lang.Object cannot be applied to (org.jclouds.io.Payload)

The problem is that the deprecated Strings2.toString has been deleted (in https://github.com/jclouds/jclouds/commit/fb60d76704745317186ad700e9b7ce5a569a614d).
You can merge this Pull Request by running:

  git pull https://github.com/aledsage/jclouds-labs fix/docker-toString-usage

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

  https://github.com/jclouds/jclouds-labs/pull/69

-- Commit Summary --

  * Fix DockerErrorHandler’s use of Strings2.toString

-- File Changes --

    M docker/src/main/java/org/jclouds/docker/handlers/DockerErrorHandler.java (18)

-- Patch Links --

https://github.com/jclouds/jclouds-labs/pull/69.patch
https://github.com/jclouds/jclouds-labs/pull/69.diff

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

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by Ignasi Barrera <no...@github.com>.
Yep, that will happen in all downstream repos. This is the bad thing about having several git repositories, changes like this have to wait in the downstream repos until the snapshots of the main one are populated.

Thanks for taking care of this @aledsage!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/69#issuecomment-49332921

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by Ignasi Barrera <no...@github.com>.
Thanks @aledsage! I've done a quick search in the rest of downstream repos and there should not be other references to the removed method.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/69#issuecomment-49407583

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1309](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1309/) 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-labs/pull/69#issuecomment-49366313

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by Andrea Turli <no...@github.com>.
The error reported by the builders is now for cdmi, similar issue

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/69#issuecomment-49332591

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1310](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1310/) 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-labs/pull/69#issuecomment-49368296

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

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

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/69#issuecomment-49366736

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by Andrew Phillips <no...@github.com>.
Thanks for the cleanup, @aledsage! +1 - looks good to me, too!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/69#issuecomment-49444198

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #210](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/210/) 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-labs/pull/69#issuecomment-49328564

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by Andrea Turli <no...@github.com>.
Lgtm :+1

Thanks @aledsage for taking care of it

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/69#issuecomment-49331519

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by Andrew Gaul <no...@github.com>.
@aledsage wrote:
> I also cleaned up some other deprecated code that seemed like quick wins. The replacement for new StringPayload(value) is quite long winded (particularly when you want to specify the charset)!
> 
> Payloads.newByteSourcePayload(ByteSource.wrap(value.getBytes(Charset.forName("UTF-8"))));

The deprecated payload types generally have only minor notational advantages for tests; usually callers have larger inputs in either in `ByteSource` or `InputStream` forms.  That being said, we could provide helper overrides to Payloads which take `byte[]` and `String` and automatically return `ByteSource` or provide some helper classes which extend `ByteSource`.  However, I have observed many users suboptimally using the deprecated APIs, for example reading entire inputs instead of streaming inputs, so providing a narrower interface might nudge them to the more optimal uses.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/69#issuecomment-49499408

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1307](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1307/) 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-labs/pull/69#issuecomment-49328260

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by Andrew Gaul <no...@github.com>.
For example, many users call one of the following:

```
newPayload(ByteStreams.toByteArray(new FileInputStream(File)))
newPayload(new FileInputStream(File))
```

The former leaks a file descriptor and consumes extra memory while the latter disables repeatable payloads.  Instead users should call the more optimal:

```
newPayload(Files.asByteSource(File))
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/69#issuecomment-49499481

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

Posted by Aled Sage <no...@github.com>.
Thanks @andreaturli @nacx - I've fixed the toString errors in other projects.

I've commented on https://issues.apache.org/jira/browse/JCLOUDS-622 suggesting that we don't delete `Strings2#toString(InputSupplier)` method yet.

I also cleaned up some other deprecated code that seemed like quick wins. The replacement for `new StringPayload(value)` is quite long winded (particularly when you want to specify the charset)!

    Payloads.newByteSourcePayload(ByteSource.wrap(value.getBytes(Charset.forName("UTF-8"))));

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/69#issuecomment-49364841

Re: [jclouds-labs] Fix DockerErrorHandler’s use of Strings2.toString (#69)

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

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/69#issuecomment-49366300