You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by di...@apache.org on 2015/04/14 18:40:01 UTC
incubator-ranger git commit: RANGER-344: Cleanup/fixes to comply with
best practices
Repository: incubator-ranger
Updated Branches:
refs/heads/master de598fada -> acfccc4a8
RANGER-344: Cleanup/fixes to comply with best practices
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/acfccc4a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/acfccc4a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/acfccc4a
Branch: refs/heads/master
Commit: acfccc4a84fc72596fe258464260c1a0653cd6d3
Parents: de598fa
Author: Dilli Dorai Arumugam <da...@hortonworks.com>
Authored: Mon Apr 13 17:31:56 2015 -0700
Committer: Dilli Dorai Arumugam <da...@hortonworks.com>
Committed: Tue Apr 14 09:39:42 2015 -0700
----------------------------------------------------------------------
.../process/LdapUserGroupBuilder.java | 18 ++++----
.../ranger/unixusersync/poc/ListUserTest.java | 44 +++++++++++---------
.../process/PolicyMgrUserGroupBuilder.java | 2 +-
3 files changed, 35 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/acfccc4a/ugsync/src/main/java/org/apache/ranger/ldapusersync/process/LdapUserGroupBuilder.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/org/apache/ranger/ldapusersync/process/LdapUserGroupBuilder.java b/ugsync/src/main/java/org/apache/ranger/ldapusersync/process/LdapUserGroupBuilder.java
index 5b959a0..93893ef 100644
--- a/ugsync/src/main/java/org/apache/ranger/ldapusersync/process/LdapUserGroupBuilder.java
+++ b/ugsync/src/main/java/org/apache/ranger/ldapusersync/process/LdapUserGroupBuilder.java
@@ -350,16 +350,18 @@ public class LdapUserGroupBuilder implements UserGroupSource {
Set<String> computedGroups = new HashSet<String>();
while (groupSearchResultEnum.hasMore()) {
final SearchResult groupEntry = groupSearchResultEnum.next();
- String gName = (String) groupEntry.getAttributes()
- .get(groupNameAttribute).get();
- if (groupNameCaseConversionFlag) {
- if (groupNameLowerCaseFlag) {
- gName = gName.toLowerCase();
- } else {
- gName = gName.toUpperCase();
+ if (groupEntry != null) {
+ String gName = (String) groupEntry.getAttributes()
+ .get(groupNameAttribute).get();
+ if (groupNameCaseConversionFlag) {
+ if (groupNameLowerCaseFlag) {
+ gName = gName.toLowerCase();
+ } else {
+ gName = gName.toUpperCase();
+ }
}
+ computedGroups.add(gName);
}
- computedGroups.add(gName);
}
if (LOG.isInfoEnabled()) {
LOG.info("computed groups for user: " + userName +", groups: " + computedGroups);
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/acfccc4a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserTest.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserTest.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserTest.java
index d7424f1..fee780e 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserTest.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserTest.java
@@ -1,22 +1,22 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.ranger.unixusersync.poc;
import java.io.BufferedReader;
@@ -37,7 +37,11 @@ public class ListUserTest
while ((strLine = br.readLine()) != null) {
ListRangerUser userList = ListRangerUser.parseUser(strLine);
- System.out.println(userList.getName() + " " + userList.getUid() + " " + userList.getGid());
+ if (userList != null) {
+ System.out.println(userList.getName() + " " + userList.getUid() + " " + userList.getGid());
+ } else {
+ System.out.println("userList is null");
+ }
}
file.close();
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/acfccc4a/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
index acbee13..6d78d25 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/process/PolicyMgrUserGroupBuilder.java
@@ -130,7 +130,7 @@ public class PolicyMgrUserGroupBuilder implements UserGroupSink {
}
- public void init() throws Throwable {
+ synchronized public void init() throws Throwable {
recordsToPullPerCall = config.getMaxRecordsPerAPICall() ;
policyMgrBaseUrl = config.getPolicyManagerBaseURL() ;
isMockRun = config.isMockRunEnabled() ;