Source:
<code>public ReturnStatus printUserGuid(String domain, String username, String password, String ldapServerUrl, StringBuffer userGuid, LdapProviderType ldapProviderType) { LdapContextSource contextSource = getContextSource(domain, ldapProviderType, username, password, ldapServerUrl); try { contextSource.afterPropertiesSet(); } catch (Exception e) { System.err.println(ERROR_PREFIX + "Failed setting LDAP context for domain " + domain); return ReturnStatus.LDAP_CONTEXT_FAILURE; } LdapTemplate ldapTemplate = new LdapTemplate(contextSource); <START> String query = ""; <END> ContextMapper contextMapper; if (ldapProviderType.equals(LdapProviderType.ipa)) { query = "(&(objectClass=posixAccount)(objectClass=krbPrincipalAux)(uid=" + username + "))"; contextMapper = new IPAUserContextMapper(); } else if (ldapProviderType.equals(LdapProviderType.activeDirectory)) { contextMapper = new ADUserContextMapper(); } else if (ldapProviderType.equals(LdapProviderType.ibm)) { query = "(&(objectClass=person)(uid=" + username + "))"; contextMapper = new IBMDSUserContextMapper(); } else { query = "(&(objectClass=person)(uid=" + username + "))"; contextMapper = new RHDSUserContextMapper(); } try { List searchResult = ldapTemplate.search("", query, contextMapper); if (searchResult == null) { System.err.println(ERROR_PREFIX + "Cannot query user " + username + " from domain " + domain); return ReturnStatus.CANNOT_QUERY_USER; } else { userGuid.append((String) searchResult.get(0)); System.out.println("User guid is: " + userGuid.toString()); } } catch (org.springframework.ldap.AuthenticationException authEx) { return authenticationReturnStatus(authEx, username, domain); } catch (Exception ex) { System.err.println(ERROR_PREFIX + "Cannot query user " + username + " from domain " + domain + ", details: " + ex.getMessage()); return ReturnStatus.CANNOT_QUERY_USER; } return ReturnStatus.OK; }</code><technical_language>In general, hard follow changes formatting introduced. I recommend try avoid this. set in Eclipse IDE change formatting of changed parts saving</technical_language>

Target:
public ReturnStatus printUserGuid(String domain, String username, String password, String ldapServerUrl, StringBuffer userGuid, LdapProviderType ldapProviderType) { LdapContextSource contextSource = getContextSource(domain, ldapProviderType, username, password, ldapServerUrl); try { contextSource.afterPropertiesSet(); } catch (Exception e) { System.err.println(ERROR_PREFIX + "Failed setting LDAP context for domain " + domain); return ReturnStatus.LDAP_CONTEXT_FAILURE; } LdapTemplate ldapTemplate = new LdapTemplate(contextSource); String query = ""; ContextMapper contextMapper; if (ldapProviderType.equals(LdapProviderType.ipa)) { query = "(&(objectClass=posixAccount)(objectClass=krbPrincipalAux)(uid=" + username + "))"; contextMapper = new IPAUserContextMapper(); } else if (ldapProviderType.equals(LdapProviderType.activeDirectory)) { contextMapper = new ADUserContextMapper(); } else if (ldapProviderType.equals(LdapProviderType.itds)) { query = "(&(objectClass=person)(uid=" + username + "))"; contextMapper = new ITDSUserContextMapper(); } else { query = "(&(objectClass=person)(uid=" + username + "))"; contextMapper = new RHDSUserContextMapper(); } try { List searchResult = ldapTemplate.search("", query, contextMapper); if (searchResult == null) { System.err.println(ERROR_PREFIX + "Cannot query user " + username + " from domain " + domain); return ReturnStatus.CANNOT_QUERY_USER; } else { userGuid.append((String) searchResult.get(0)); System.out.println("User guid is: " + userGuid.toString()); } } catch (org.springframework.ldap.AuthenticationException authEx) { return authenticationReturnStatus(authEx, username, domain); } catch (Exception ex) { System.err.println(ERROR_PREFIX + "Cannot query user " + username + " from domain " + domain + ", details: " + ex.getMessage()); return ReturnStatus.CANNOT_QUERY_USER; } return ReturnStatus.OK; }