CLOUDSTACK-6089: Use resource tag's key to determine match in equals() method for ResourceTagResponse (cherry picked from commit ed73e3e1b30c7c49c5dbfe8f2cac3d3dac85090e)
Signed-off-by: Animesh Chaturvedi <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0ff15225 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0ff15225 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0ff15225 Branch: refs/heads/4.3 Commit: 0ff152258eb62db09ba5cad2698a2e9d370fdd7c Parents: 1c64044 Author: Marcus Sorensen <[email protected]> Authored: Wed Feb 12 17:00:10 2014 -0700 Committer: Animesh Chaturvedi <[email protected]> Committed: Thu Feb 13 15:56:08 2014 -0800 ---------------------------------------------------------------------- .../api/response/ResourceTagResponse.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ff15225/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java index 8044376..00db1b5 100644 --- a/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java @@ -102,16 +102,16 @@ public class ResourceTagResponse extends BaseResponse implements ControlledViewE this.customer = customer; } - public String getResourceId() { - return this.resourceId; + public String getKey() { + return this.key; } @Override public int hashCode() { final int prime = 31; int result = 1; - String rId = this.getResourceId(); - result = prime * result + ((rId== null) ? 0 : rId.hashCode()); + String key = this.getKey(); + result = prime * result + ((key == null) ? 0 : key.hashCode()); return result; } @@ -121,13 +121,14 @@ public class ResourceTagResponse extends BaseResponse implements ControlledViewE return true; if (obj == null) return false; - if (this.getClass() != obj.getClass()) + if (getClass() != obj.getClass()) return false; ResourceTagResponse other = (ResourceTagResponse) obj; - String rId = this.getResourceId(); - if (rId == null && other.getResourceId() != null) { - return false; - } else if (!rId.equals(other.getResourceId())) + String key = this.getKey(); + if (key == null) { + if (other.getKey() != null) + return false; + } else if (!key.equals(other.getKey())) return false; return true; }
