You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "rameeshm (via GitHub)" <gi...@apache.org> on 2023/02/07 04:51:45 UTC

[GitHub] [ranger] rameeshm commented on a diff in pull request #210: RANGER-4071: Support for LDAP/AD usernames and group names with special chars

rameeshm commented on code in PR #210:
URL: https://github.com/apache/ranger/pull/210#discussion_r1098174354


##########
ugsync/src/main/java/org/apache/ranger/unixusersync/config/UserGroupSyncConfig.java:
##########
@@ -1332,6 +1335,18 @@ public boolean isUserSyncNameValidationEnabled() {
 		return isUserSyncNameValidationEnabled;
 	}
 
+	public String getRegexSeparator() throws RuntimeException {
+		String val = prop.getProperty(SYNC_MAPPING_SEPARATOR);
+		if(StringUtils.isNotEmpty(val)) {
+			if (val.length() == 1)
+				return val;
+			else{
+				throw new RuntimeException("More than one character found in RegEx Separator");
+			}
+		}
+		return DEFAULT_MAPPING_SEPARATOR;

Review Comment:
   We follow this pattern with in the Ranger Code for method returns, I would recommend to do the same
   String ret = DEFAULT_MAPPING_SEPARATOR;
   String val = prop.getProperty(SYNC_MAPPING_SEPARATOR);
   if (StringUtilts.isNotEmpty(val))  {
         if (val.length() == 1) {
                ret = val;
         } else {
                throw new RuntimeException("More than one character found in RegEx Separator");
           }
    }
     return ret;
   }
             



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org