Program: 166226
Project: 166226
Buggy source:
private void getUsers(UserGroupSink sink) throws Throwable {
  NamingEnumeration<SearchResult> userSearchResultEnum=null;
  NamingEnumeration<SearchResult> groupSearchResultEnum=null;
  try {
    createLdapContext();
    int total;
    if (pagedResultsEnabled) {
      ldapContext.setRequestControls(new Control[]{new PagedResultsControl(pagedResultsSize,Control.NONCRITICAL)});
    }
    DateFormat dateFormat=new SimpleDateFormat("String_Node_Str");
    extendedUserSearchFilter="String_Node_Str" + userObjectClass + "String_Node_Str"+ deltaSyncUserTime+ "String_Node_Str"+ deltaSyncUserTimeStamp+ "String_Node_Str";
    if (userSearchFilter != null && !userSearchFilter.trim().isEmpty()) {
      String customFilter=userSearchFilter.trim();
      if (!customFilter.startsWith("String_Node_Str")) {
        customFilter="String_Node_Str" + customFilter + "String_Node_Str";
      }
      extendedUserSearchFilter="String_Node_Str" + extendedUserSearchFilter + customFilter+ "String_Node_Str";
    }
 else {
      extendedUserSearchFilter="String_Node_Str" + extendedUserSearchFilter + "String_Node_Str";
    }
    LOG.info("String_Node_Str" + extendedUserSearchFilter);
    long highestdeltaSyncUserTime=deltaSyncUserTime;
    for (int ou=0; ou < userSearchBase.length; ou++) {
      byte[] cookie=null;
      int counter=0;
      try {
        do {
          userSearchResultEnum=ldapContext.search(userSearchBase[ou],extendedUserSearchFilter,userSearchControls);
          while (userSearchResultEnum.hasMore()) {
            final SearchResult userEntry=userSearchResultEnum.next();
            if (userEntry == null) {
              if (LOG.isInfoEnabled()) {
                LOG.info("String_Node_Str");
              }
              continue;
            }
            Attributes attributes=userEntry.getAttributes();
            if (attributes == null) {
              if (LOG.isInfoEnabled()) {
                LOG.info("String_Node_Str" + userEntry.getNameInNamespace() + "String_Node_Str");
              }
              continue;
            }
            Attribute userNameAttr=attributes.get(userNameAttribute);
            if (userNameAttr == null) {
              if (LOG.isInfoEnabled()) {
                LOG.info(userNameAttribute + "String_Node_Str" + userEntry.getNameInNamespace()+ "String_Node_Str");
              }
              continue;
            }
            String userName=(String)userNameAttr.get();
            if (userName == null || userName.trim().isEmpty()) {
              if (LOG.isInfoEnabled()) {
                LOG.info(userNameAttribute + "String_Node_Str" + userEntry.getNameInNamespace()+ "String_Node_Str");
              }
              continue;
            }
            Attribute timeStampAttr=attributes.get("String_Node_Str");
            if (timeStampAttr != null) {
              String uSNChangedVal=(String)timeStampAttr.get();
              long currentDeltaSyncTime=Long.parseLong(uSNChangedVal);
              LOG.info("String_Node_Str" + uSNChangedVal + "String_Node_Str"+ currentDeltaSyncTime);
              if (currentDeltaSyncTime > highestdeltaSyncUserTime) {
                highestdeltaSyncUserTime=currentDeltaSyncTime;
              }
            }
 else {
              timeStampAttr=attributes.get("String_Node_Str");
              if (timeStampAttr != null) {
                String timeStampVal=(String)timeStampAttr.get();
                Date parseDate=dateFormat.parse(timeStampVal);
                long currentDeltaSyncTime=parseDate.getTime();
                LOG.info("String_Node_Str" + timeStampVal + "String_Node_Str"+ currentDeltaSyncTime);
                if (currentDeltaSyncTime > highestdeltaSyncUserTime) {
                  highestdeltaSyncUserTime=currentDeltaSyncTime;
                  deltaSyncUserTimeStamp=timeStampVal;
                }
              }
            }
            if (!groupSearchFirstEnabled) {
              String transformUserName=userNameTransform(userName);
              try {
                sink.addOrUpdateUser(transformUserName);
              }
 catch (              Throwable t) {
                LOG.error("String_Node_Str" + t.getMessage() + "String_Node_Str"+ transformUserName);
              }
              Set<String> groups=new HashSet<String>();
              if (!groupSearchEnabled) {
                for (                String useGroupNameAttribute : userGroupNameAttributeSet) {
                  Attribute userGroupfAttribute=userEntry.getAttributes().get(useGroupNameAttribute);
                  if (userGroupfAttribute != null) {
                    NamingEnumeration<?> groupEnum=userGroupfAttribute.getAll();
                    while (groupEnum.hasMore()) {
                      String gName=getShortGroupName((String)groupEnum.next());
                      String transformGroupName=groupNameTransform(gName);
                      groups.add(transformGroupName);
                    }
                  }
                }
              }
              List<String> groupList=new ArrayList<String>(groups);
              try {
                sink.addOrUpdateUser(transformUserName,groupList);
              }
 catch (              Throwable t) {
                LOG.error("String_Node_Str" + t.getMessage() + "String_Node_Str"+ transformUserName+ "String_Node_Str"+ groupList);
              }
              counter++;
              if (counter <= 2000) {
                if (LOG.isInfoEnabled()) {
                  LOG.info("String_Node_Str" + counter + "String_Node_Str"+ userName+ "String_Node_Str"+ groupList);
                }
                if (counter == 2000) {
                  LOG.info("String_Node_Str");
                }
              }
 else {
                if (LOG.isTraceEnabled()) {
                  LOG.trace("String_Node_Str" + counter + "String_Node_Str"+ userName+ "String_Node_Str"+ groupList);
                }
 else {
                  if (counter % 100 == 0) {
                    LOG.info("String_Node_Str" + counter + "String_Node_Str");
                  }
                }
              }
            }
 else {
              String userFullName=(userEntry.getNameInNamespace()).toLowerCase();
              LOG.debug("String_Node_Str" + userFullName + "String_Node_Str");
              if (groupUserTable.containsColumn(userFullName) || groupUserTable.containsColumn(userName)) {
                String transformUserName=userNameTransform(userName);
                try {
                  sink.addOrUpdateUser(transformUserName);
                }
 catch (                Throwable t) {
                  LOG.error("String_Node_Str" + t.getMessage() + "String_Node_Str"+ transformUserName);
                }
              }
            }
          }
          Control[] controls=ldapContext.getResponseControls();
          if (controls != null) {
            for (int i=0; i < controls.length; i++) {
              if (controls[i] instanceof PagedResultsResponseControl) {
                PagedResultsResponseControl prrc=(PagedResultsResponseControl)controls[i];
                total=prrc.getResultSize();
                if (total != 0) {
                  LOG.debug("String_Node_Str" + total);
                }
 else {
                  LOG.debug("String_Node_Str");
                }
                cookie=prrc.getCookie();
              }
            }
          }
 else {
            LOG.debug("String_Node_Str");
          }
          if (pagedResultsEnabled) {
            ldapContext.setRequestControls(new Control[]{new PagedResultsControl(PAGE_SIZE,cookie,Control.CRITICAL)});
          }
        }
 while (cookie != null);
        LOG.info("String_Node_Str" + counter);
      }
 catch (      Throwable t) {
        LOG.error("String_Node_Str" + t);
        LOG.info("String_Node_Str" + counter);
      }
    }
    if (deltaSyncUserTime < highestdeltaSyncUserTime) {
      deltaSyncUserTime=highestdeltaSyncUserTime + 1;
      deltaSyncUserTimeStamp=dateFormat.format(new Date(highestdeltaSyncUserTime + 60l));
    }
  }
  finally {
    if (userSearchResultEnum != null) {
      userSearchResultEnum.close();
    }
    if (groupSearchResultEnum != null) {
      groupSearchResultEnum.close();
    }
    closeLdapContext();
  }
}

Fixed version (ground truth):
private void getUsers(UserGroupSink sink) throws Throwable {
  NamingEnumeration<SearchResult> userSearchResultEnum=null;
  NamingEnumeration<SearchResult> groupSearchResultEnum=null;
  try {
    createLdapContext();
    int total;
    if (pagedResultsEnabled) {
      ldapContext.setRequestControls(new Control[]{new PagedResultsControl(pagedResultsSize,Control.NONCRITICAL)});
    }
    DateFormat dateFormat=new SimpleDateFormat("String_Node_Str");
    extendedUserSearchFilter="String_Node_Str" + userObjectClass + "String_Node_Str"+ deltaSyncUserTime+ "String_Node_Str"+ deltaSyncUserTimeStamp+ "String_Node_Str";
    if (userSearchFilter != null && !userSearchFilter.trim().isEmpty()) {
      String customFilter=userSearchFilter.trim();
      if (!customFilter.startsWith("String_Node_Str")) {
        customFilter="String_Node_Str" + customFilter + "String_Node_Str";
      }
      extendedUserSearchFilter="String_Node_Str" + extendedUserSearchFilter + customFilter+ "String_Node_Str";
    }
 else {
      extendedUserSearchFilter="String_Node_Str" + extendedUserSearchFilter + "String_Node_Str";
    }
    LOG.info("String_Node_Str" + extendedUserSearchFilter);
    long highestdeltaSyncUserTime=deltaSyncUserTime;
    for (int ou=0; ou < userSearchBase.length; ou++) {
      byte[] cookie=null;
      int counter=0;
      try {
        do {
          userSearchResultEnum=ldapContext.search(userSearchBase[ou],extendedUserSearchFilter,userSearchControls);
          while (userSearchResultEnum.hasMore()) {
            final SearchResult userEntry=userSearchResultEnum.next();
            if (userEntry == null) {
              if (LOG.isInfoEnabled()) {
                LOG.info("String_Node_Str");
              }
              continue;
            }
            Attributes attributes=userEntry.getAttributes();
            if (attributes == null) {
              if (LOG.isInfoEnabled()) {
                LOG.info("String_Node_Str" + userEntry.getNameInNamespace() + "String_Node_Str");
              }
              continue;
            }
            Attribute userNameAttr=attributes.get(userNameAttribute);
            if (userNameAttr == null) {
              if (LOG.isInfoEnabled()) {
                LOG.info(userNameAttribute + "String_Node_Str" + userEntry.getNameInNamespace()+ "String_Node_Str");
              }
              continue;
            }
            String userFullName=(userEntry.getNameInNamespace()).toLowerCase();
            String userName=(String)userNameAttr.get();
            if (userName == null || userName.trim().isEmpty()) {
              if (LOG.isInfoEnabled()) {
                LOG.info(userNameAttribute + "String_Node_Str" + userEntry.getNameInNamespace()+ "String_Node_Str");
              }
              continue;
            }
            Attribute timeStampAttr=attributes.get("String_Node_Str");
            if (timeStampAttr != null) {
              String uSNChangedVal=(String)timeStampAttr.get();
              long currentDeltaSyncTime=Long.parseLong(uSNChangedVal);
              LOG.info("String_Node_Str" + uSNChangedVal + "String_Node_Str"+ currentDeltaSyncTime);
              if (currentDeltaSyncTime > highestdeltaSyncUserTime) {
                highestdeltaSyncUserTime=currentDeltaSyncTime;
              }
            }
 else {
              timeStampAttr=attributes.get("String_Node_Str");
              if (timeStampAttr != null) {
                String timeStampVal=(String)timeStampAttr.get();
                Date parseDate=dateFormat.parse(timeStampVal);
                long currentDeltaSyncTime=parseDate.getTime();
                LOG.info("String_Node_Str" + timeStampVal + "String_Node_Str"+ currentDeltaSyncTime);
                if (currentDeltaSyncTime > highestdeltaSyncUserTime) {
                  highestdeltaSyncUserTime=currentDeltaSyncTime;
                  deltaSyncUserTimeStamp=timeStampVal;
                }
              }
            }
            if (!groupSearchFirstEnabled) {
              String transformUserName=userNameTransform(userName);
              try {
                sink.addOrUpdateUser(transformUserName);
              }
 catch (              Throwable t) {
                LOG.error("String_Node_Str" + t.getMessage() + "String_Node_Str"+ transformUserName);
              }
              userNameMap.put(userFullName,transformUserName);
              Set<String> groups=new HashSet<String>();
              if (!groupSearchEnabled) {
                for (                String useGroupNameAttribute : userGroupNameAttributeSet) {
                  Attribute userGroupfAttribute=userEntry.getAttributes().get(useGroupNameAttribute);
                  if (userGroupfAttribute != null) {
                    NamingEnumeration<?> groupEnum=userGroupfAttribute.getAll();
                    while (groupEnum.hasMore()) {
                      String gName=getShortGroupName((String)groupEnum.next());
                      String transformGroupName=groupNameTransform(gName);
                      groups.add(transformGroupName);
                    }
                  }
                }
              }
              List<String> groupList=new ArrayList<String>(groups);
              try {
                sink.addOrUpdateUser(transformUserName,groupList);
              }
 catch (              Throwable t) {
                LOG.error("String_Node_Str" + t.getMessage() + "String_Node_Str"+ transformUserName+ "String_Node_Str"+ groupList);
              }
              counter++;
              if (counter <= 2000) {
                if (LOG.isInfoEnabled()) {
                  LOG.info("String_Node_Str" + counter + "String_Node_Str"+ userName+ "String_Node_Str"+ groupList);
                }
                if (counter == 2000) {
                  LOG.info("String_Node_Str");
                }
              }
 else {
                if (LOG.isTraceEnabled()) {
                  LOG.trace("String_Node_Str" + counter + "String_Node_Str"+ userName+ "String_Node_Str"+ groupList);
                }
 else {
                  if (counter % 100 == 0) {
                    LOG.info("String_Node_Str" + counter + "String_Node_Str");
                  }
                }
              }
            }
 else {
              LOG.debug("String_Node_Str" + userFullName + "String_Node_Str");
              if (groupUserTable.containsColumn(userFullName) || groupUserTable.containsColumn(userName)) {
                String transformUserName=userNameTransform(userName);
                try {
                  sink.addOrUpdateUser(transformUserName);
                }
 catch (                Throwable t) {
                  LOG.error("String_Node_Str" + t.getMessage() + "String_Node_Str"+ transformUserName);
                }
                userNameMap.put(userFullName,transformUserName);
                Map<String,String> userMap=groupUserTable.column(userFullName);
                for (                Map.Entry<String,String> entry : userMap.entrySet()) {
                  LOG.debug("String_Node_Str" + entry.getValue() + "String_Node_Str"+ transformUserName+ "String_Node_Str"+ entry.getKey());
                  groupUserTable.put(entry.getKey(),userFullName,transformUserName);
                }
              }
            }
          }
          Control[] controls=ldapContext.getResponseControls();
          if (controls != null) {
            for (int i=0; i < controls.length; i++) {
              if (controls[i] instanceof PagedResultsResponseControl) {
                PagedResultsResponseControl prrc=(PagedResultsResponseControl)controls[i];
                total=prrc.getResultSize();
                if (total != 0) {
                  LOG.debug("String_Node_Str" + total);
                }
 else {
                  LOG.debug("String_Node_Str");
                }
                cookie=prrc.getCookie();
              }
            }
          }
 else {
            LOG.debug("String_Node_Str");
          }
          if (pagedResultsEnabled) {
            ldapContext.setRequestControls(new Control[]{new PagedResultsControl(PAGE_SIZE,cookie,Control.CRITICAL)});
          }
        }
 while (cookie != null);
        LOG.info("String_Node_Str" + counter);
      }
 catch (      Exception t) {
        LOG.error("String_Node_Str" + t);
        LOG.info("String_Node_Str" + counter);
      }
    }
    if (deltaSyncUserTime < highestdeltaSyncUserTime) {
      deltaSyncUserTime=highestdeltaSyncUserTime + 1;
      deltaSyncUserTimeStamp=dateFormat.format(new Date(highestdeltaSyncUserTime + 60l));
    }
  }
  finally {
    if (userSearchResultEnum != null) {
      userSearchResultEnum.close();
    }
    if (groupSearchResultEnum != null) {
      groupSearchResultEnum.close();
    }
    closeLdapContext();
  }
}