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 Gaul <no...@github.com> on 2014/09/01 07:51:36 UTC

[jclouds-labs] Address FindBugs warnings (#71)

You can merge this Pull Request by running:

  git pull https://github.com/andrewgaul/jclouds-labs findbugs

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

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

-- Commit Summary --

  * Address FindBugs warnings

-- File Changes --

    M abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/AbiquoComputeServiceAdapter.java (4)
    M cdmi/src/main/java/org/jclouds/snia/cdmi/v1/options/ListContainersOptions.java (2)
    M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/DrivesListRequestFieldsGroup.java (16)
    M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerAvailabilityGroup.java (16)
    M digitalocean/src/main/java/org/jclouds/digitalocean/compute/extensions/DigitalOceanImageExtension.java (2)
    M digitalocean/src/main/java/org/jclouds/digitalocean/compute/strategy/DigitalOceanComputeServiceAdapter.java (12)
    M digitalocean/src/main/java/org/jclouds/digitalocean/ssh/DSAKeys.java (3)
    M docker/src/main/java/org/jclouds/docker/domain/Container.java (3)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/Blob.java (11)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/BlobMetadata.java (19)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/ContentMetadata.java (17)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/blobstore/representations/StorageMetadata.java (17)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/ExecResponse.java (12)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Hardware.java (16)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Image.java (17)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/LoginCredentials.java (14)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/NodeMetadata.java (21)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/OperatingSystem.java (15)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Processor.java (11)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/compute/representations/Volume.java (15)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/representations/ApiMetadata.java (23)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/representations/Context.java (12)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/representations/Location.java (14)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/representations/ProviderMetadata.java (23)
    M jclouds-representations/representations-core/src/main/java/org/jclouds/representations/Representations.java (4)
    M virtualbox/src/main/java/org/jclouds/virtualbox/functions/CreateAndInstallVm.java (3)

-- Patch Links --

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

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Andrew Gaul <no...@github.com>.
> @@ -189,7 +189,7 @@ public VirtualMachineTemplate getImage(final String id) {
>        return find(listImages(), new Predicate<VirtualMachineTemplate>() {
>           @Override
>           public boolean apply(VirtualMachineTemplate input) {
> -            return input.getId().equals(id);
> +            return input.getId().equals(id);  // TODO: comparing Integer with String

Done.

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Andrew Gaul <no...@github.com>.
Closed #71.

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Andrew Gaul <no...@github.com>.
> @@ -122,6 +122,9 @@ public IMachine apply(MasterSpec masterSpec) {
>        logger.debug(">> awaiting installation of guest additions on vm: %s", masterName);
>        ListenableFuture<ExecResponse> execInstallGA = machineUtils.runScriptOnNode(nodeMetadata,
>                 new InstallGuestAdditions(vmSpec, version), RunScriptOptions.NONE);
> +      ExecResponse execInstallGAResponse = Futures.getUnchecked(execInstallGA);
> +      checkState(execInstallGAResponse.getExitStatus() == 0, "exec installation of guest additions on vm(%s) " +
> +              "failed", masterName);

Functional change.

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Andrew Gaul <no...@github.com>.
>     public static String dateFormat(Date date) {
> -      return date != null ? DATE_FORMAT.format(date) : "";
> +      return date != null ? new SimpleDateFormat("dd/MM/yyyy HH:mm:ss zzz").format(date) : "";

`DateFormat` is a mutable class.  Unsure whether reducing this to private access would satisfy FindBugs.

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Ignasi Barrera <no...@github.com>.
> @@ -189,7 +189,7 @@ public VirtualMachineTemplate getImage(final String id) {
>        return find(listImages(), new Predicate<VirtualMachineTemplate>() {
>           @Override
>           public boolean apply(VirtualMachineTemplate input) {
> -            return input.getId().equals(id);
> +            return input.getId().equals(id);  // TODO: comparing Integer with String

WTF. Didn't notice that. It would be safe to compare the integer form. The String should be an integer as per: https://github.com/jclouds/jclouds-labs/blob/master/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineTemplateToImage.java#L62
Thanks for spotting this!

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Andrew Phillips <no...@github.com>.
>     public static String dateFormat(Date date) {
> -      return date != null ? DATE_FORMAT.format(date) : "";
> +      return date != null ? new SimpleDateFormat("dd/MM/yyyy HH:mm:ss zzz").format(date) : "";

Fine to leave as-is - was just a curiosity question. We're not mutating it, but it doesn't explicitly say that concurrent calls to `format` are thread-safe, so let's just stick with the change.

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Andrew Gaul <no...@github.com>.
I believe the string-based equals was just a shortcut.  Not a terrible one, although less efficient than the traditional approach.

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

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

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Andrew Gaul <no...@github.com>.
Pushed to master as 4df85169ea00bc170a35ca5a7476cb6b481ede90.  We have two remaining violations with static Logger in `org.jclouds.vcloud.director.v1_5.domain.Error` and `org.jclouds.vcloud.director.v1_5.domain.Resource` that I could not figure out.

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by BuildHive <no...@github.com>.
[jclouds ยป jclouds-labs #1469](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1469/) 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/71#issuecomment-54018715

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Andrew Phillips <no...@github.com>.
+1 - thanks for that, @andrewgaul! Curious about all those string-based equals implementations we had...was that just a shortcut, or were they intentional in some way?

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Andrew Phillips <no...@github.com>.
>     public static String dateFormat(Date date) {
> -      return date != null ? DATE_FORMAT.format(date) : "";
> +      return date != null ? new SimpleDateFormat("dd/MM/yyyy HH:mm:ss zzz").format(date) : "";

Curious about this one? I guess it's the lack of synchronization we're fixing here..?

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

Re: [jclouds-labs] Address FindBugs warnings (#71)

Posted by Andrew Gaul <no...@github.com>.
> @@ -189,7 +189,7 @@ public VirtualMachineTemplate getImage(final String id) {
>        return find(listImages(), new Predicate<VirtualMachineTemplate>() {
>           @Override
>           public boolean apply(VirtualMachineTemplate input) {
> -            return input.getId().equals(id);
> +            return input.getId().equals(id);  // TODO: comparing Integer with String

@nacx Can you investigate this?

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