You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by pr...@apache.org on 2020/04/17 13:02:07 UTC

[ranger] branch master updated: RANGER-2786: Ranger usersync group modifyTimestamp parsing should be in 24 hours format

This is an automated email from the ASF dual-hosted git repository.

pradeep pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new a9028bb  RANGER-2786: Ranger usersync group modifyTimestamp parsing should be in 24 hours format
a9028bb is described below

commit a9028bb31d143ce527d89413a8d13f6fe56f2bbf
Author: pradeep <pr...@apache.org>
AuthorDate: Fri Apr 10 11:24:52 2020 +0530

    RANGER-2786: Ranger usersync group modifyTimestamp parsing should be in 24 hours format
---
 .../ranger/ldapusersync/process/LdapDeltaUserGroupBuilder.java     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ugsync/src/main/java/org/apache/ranger/ldapusersync/process/LdapDeltaUserGroupBuilder.java b/ugsync/src/main/java/org/apache/ranger/ldapusersync/process/LdapDeltaUserGroupBuilder.java
index 3ff2470..011c9c6 100644
--- a/ugsync/src/main/java/org/apache/ranger/ldapusersync/process/LdapDeltaUserGroupBuilder.java
+++ b/ugsync/src/main/java/org/apache/ranger/ldapusersync/process/LdapDeltaUserGroupBuilder.java
@@ -71,6 +71,7 @@ public class LdapDeltaUserGroupBuilder extends AbstractUserGroupSource {
 	private static final Logger LOG = Logger.getLogger(LdapDeltaUserGroupBuilder.class);
 	
 	private static final String DATA_TYPE_BYTEARRAY = "byte[]";
+	private static final String DATE_FORMAT = "yyyyMMddHHmmss";
 	private static final int PAGE_SIZE = 500;
 	private static long deltaSyncUserTime = 0; // Used for AD uSNChanged 
 	private static long deltaSyncGroupTime = 0; // Used for AD uSNChanged
@@ -168,7 +169,7 @@ public class LdapDeltaUserGroupBuilder extends AbstractUserGroupSource {
 	public void init() throws Throwable{
 		deltaSyncUserTime = 0;
 		deltaSyncGroupTime = 0;
-		DateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
+		DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
 		deltaSyncUserTimeStamp = dateFormat.format(new Date(0));
 		deltaSyncGroupTimeStamp = dateFormat.format(new Date(0));
 		userNameMap = new HashMap<String, String>();
@@ -471,7 +472,7 @@ public class LdapDeltaUserGroupBuilder extends AbstractUserGroupSource {
 				ldapContext.setRequestControls(new Control[]{
 						new PagedResultsControl(pagedResultsSize, Control.NONCRITICAL) });
 			}
-			DateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
+			DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
 			if (groupSearchFirstEnabled && groupUserTable.rowKeySet().size() != 0) {
 				// Fix RANGER-1957: Perform full sync when group search is enabled and when there are updates to the groups
 				deltaSyncUserTime = 0;
@@ -737,7 +738,7 @@ public class LdapDeltaUserGroupBuilder extends AbstractUserGroupSource {
 
 	private void getGroups(UserGroupSink sink) throws Throwable {
 		NamingEnumeration<SearchResult> groupSearchResultEnum = null;
-        DateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
+        DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
         long highestdeltaSyncGroupTime = deltaSyncGroupTime;
 		try {
 			createLdapContext();