You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ud...@apache.org on 2015/04/16 06:04:37 UTC
[4/4] stratos git commit: fix equals method
fix equals method
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d86b9cba
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d86b9cba
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d86b9cba
Branch: refs/heads/master
Commit: d86b9cba902943d063abe7b2f9788f72104e4ec2
Parents: 7b09bc1
Author: Udara Liyanage <ud...@wso2.com>
Authored: Sun Apr 12 08:24:32 2015 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Thu Apr 16 09:33:45 2015 +0530
----------------------------------------------------------------------
.../stratos/metadata/service/security/StratosPrincipal.java | 8 +++++++-
.../stratos/rest/endpoint/security/StratosPrincipal.java | 7 ++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/d86b9cba/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosPrincipal.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosPrincipal.java b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosPrincipal.java
index 5bd6336..788dc59 100644
--- a/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosPrincipal.java
+++ b/components/org.apache.stratos.metadata.service/src/main/java/org/apache/stratos/metadata/service/security/StratosPrincipal.java
@@ -36,7 +36,13 @@ public class StratosPrincipal implements Principal {
}
public boolean equals(Object another) {
- return userName.equals((another));
+
+ if (another == null || another.getClass() != this.getClass()) {
+ return false;
+ }
+
+ StratosPrincipal principal = (StratosPrincipal) another;
+ return userName.equals((principal.getName()));
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/stratos/blob/d86b9cba/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/security/StratosPrincipal.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/security/StratosPrincipal.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/security/StratosPrincipal.java
index cf538f1..210e128 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/security/StratosPrincipal.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/security/StratosPrincipal.java
@@ -36,7 +36,12 @@ public class StratosPrincipal implements Principal {
}
public boolean equals(Object another) {
- return userName.equals((another));
+ if (another == null || another.getClass() != this.getClass()) {
+ return false;
+ }
+
+ StratosPrincipal principal = (StratosPrincipal) another;
+ return userName.equals((principal.getName()));
}
public String toString() {