From 0ff152258eb62db09ba5cad2698a2e9d370fdd7c Mon Sep 17 00:00:00 2001 From: Marcus Sorensen Date: Wed, 12 Feb 2014 17:00:10 -0700 Subject: [PATCH] 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 --- .../api/response/ResourceTagResponse.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java index 8044376c863..00db1b5f5fd 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; }