ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pengjian...@apache.org
Subject ranger git commit: RANGER-2238: String comparison should not use '==' in ServiceUtil.java
Date Fri, 12 Oct 2018 05:46:04 GMT
Repository: ranger
Updated Branches:
  refs/heads/ranger-1 4fb108a3f -> f2a080d5d


RANGER-2238: String comparison should not use '==' in ServiceUtil.java

Signed-off-by: peng.jianhua <peng.jianhua@zte.com.cn>


Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/f2a080d5
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/f2a080d5
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/f2a080d5

Branch: refs/heads/ranger-1
Commit: f2a080d5dd9e9b931b8f19045633b36a7b76a2bd
Parents: 4fb108a
Author: zhangqiang2 <zhangqiang2@zte.com.cn>
Authored: Mon Oct 8 10:06:32 2018 +0800
Committer: peng.jianhua <peng.jianhua@zte.com.cn>
Committed: Fri Oct 12 13:45:39 2018 +0800

----------------------------------------------------------------------
 .../org/apache/ranger/common/ServiceUtil.java   | 30 ++++++++++----------
 1 file changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/f2a080d5/security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java b/security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java
index 0292881..c82636a 100644
--- a/security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java
+++ b/security-admin/src/main/java/org/apache/ranger/common/ServiceUtil.java
@@ -854,21 +854,21 @@ public class ServiceUtil {
 		int permGroup = 0;
 		for(RangerPolicy.RangerPolicyItem policyItem : policy.getPolicyItems()) {
 			String ipAddress = null;
-			
-			for(RangerPolicy.RangerPolicyItemCondition condition : policyItem.getConditions()) {
-				if(condition.getType() == "ipaddress") {
-					List<String> values = condition.getValues();
-					if (CollectionUtils.isNotEmpty(values)) {
-						// TODO changes this to properly deal with collection for now just returning 1st item
-						ipAddress = values.get(0);
-					}
-				}
-	
-				if(ipAddress != null && !ipAddress.isEmpty()) {
-					break; // only 1 IP-address per permMap
-				}
-			}
-	
+
+            for (RangerPolicy.RangerPolicyItemCondition condition : policyItem.getConditions())
{
+                if ("ipaddress".equalsIgnoreCase(condition.getType())) {
+                    List<String> values = condition.getValues();
+                    if (CollectionUtils.isNotEmpty(values)) {
+                        // TODO changes this to properly deal with collection for now just
returning 1st item
+                        ipAddress = values.get(0);
+                    }
+                }
+
+                if (ipAddress != null && !ipAddress.isEmpty()) {
+                    break; // only 1 IP-address per permMap
+                }
+            }
+
 			for(String userName : policyItem.getUsers()) {
 				for(RangerPolicyItemAccess access : policyItem.getAccesses()) {
 					if(! access.getIsAllowed()) {


Mime
View raw message