Buggy code:
public final class LDAPAuthenticationSchemeImpl extends JNDIAuthenticationSchemeBase { private static final String dfltLDAPURL = "ldap:////" ; private String searchBaseDN ; private String leftSearchFilter ; private String rightSearchFilter ; private boolean useUserPropertyAsDN ; private String searchAuthDN ; private String searchAuthPW ; private static final String [ ] attrDN = new String [ ] { "dn" } ; private static final String LDAP_SEARCH_BASE = "derby.authentication.ldap.searchBase" ; private static final String LDAP_SEARCH_FILTER = "derby.authentication.ldap.searchFilter" ; private static final String LDAP_SEARCH_AUTH_DN = "derby.authentication.ldap.searchAuthDN" ; private static final String LDAP_SEARCH_AUTH_PW = "derby.authentication.ldap.searchAuthPW" ; private static final String LDAP_LOCAL_USER_DN = "derby.user" ; private static final String LDAP_SEARCH_FILTER_USERNAME = "%USERNAME%" ; public LDAPAuthenticationSchemeImpl ( JNDIAuthenticationService as , Properties dbProperties ) { } public boolean authenticateUser ( String userName , String userPassword , String databaseName , Properties info ) throws SQLException { } protected void setJNDIProviderProperties ( ) { if ( ( initDirContextEnv . getProperty ( Context . INITIAL_CONTEXT_FACTORY ) ) == ( ( String ) ( null ) ) ) { initDirContextEnv . put ( Context . INITIAL_CONTEXT_FACTORY , "com.sun.jndi.ldap.LdapCtxFactory" ) ; } if ( ( initDirContextEnv . getProperty ( Context . PROVIDER_URL ) ) == ( ( String ) ( null ) ) ) { String ldapServer = authenticationService . getProperty ( AUTHENTICATION_SERVER_PARAMETER ) ; if ( ldapServer == ( ( String ) ( null ) ) ) { Monitor . logTextMessage ( AUTH_NO_LDAP_HOST_MENTIONED , AUTHENTICATION_SERVER_PARAMETER ) ; this . providerURL = ( LDAPAuthenticationSchemeImpl . dfltLDAPURL ) + "//" ; } else { <START_BUG> if ( ldapServer . startsWith ( LDAPAuthenticationSchemeImpl . dfltLDAPURL ) ) <END_BUG> this . providerURL = ldapServer ; else if ( ldapServer . startsWith ( "////" ) ) this . providerURL = "ldap:" + ldapServer ; else this . providerURL = ( LDAPAuthenticationSchemeImpl . dfltLDAPURL ) + ldapServer ; } initDirContextEnv . put ( Context . PROVIDER_URL , providerURL ) ; } if ( ( initDirContextEnv . getProperty ( Context . SECURITY_AUTHENTICATION ) ) == ( ( String ) ( null ) ) ) { initDirContextEnv . put ( Context . SECURITY_AUTHENTICATION , "simple" ) ; } String ldapSearchBase = authenticationService . getProperty ( LDAPAuthenticationSchemeImpl . LDAP_SEARCH_BASE ) ; if ( ldapSearchBase != ( ( String ) ( null ) ) ) this . searchBaseDN = ldapSearchBase ; else this . searchBaseDN = "" ; this . searchAuthDN = authenticationService . getProperty ( LDAPAuthenticationSchemeImpl . LDAP_SEARCH_AUTH_DN ) ; this . searchAuthPW = authenticationService . getProperty ( LDAPAuthenticationSchemeImpl . LDAP_SEARCH_AUTH_PW ) ; String searchFilterProp = authenticationService . getProperty ( LDAPAuthenticationSchemeImpl . LDAP_SEARCH_FILTER ) ; if ( searchFilterProp == ( ( String ) ( null ) ) ) { this . leftSearchFilter = "(&(objectClass=inetOrgPerson)(uid=" ; this . rightSearchFilter = "))" ; } else if ( StringUtil . SQLEqualsIgnoreCase ( searchFilterProp , LDAPAuthenticationSchemeImpl . LDAP_LOCAL_USER_DN ) ) { this . leftSearchFilter = "(&(objectClass=inetOrgPerson)(uid=" ; this . rightSearchFilter = "))" ; this . useUserPropertyAsDN = true ; } else if ( ( searchFilterProp . indexOf ( LDAPAuthenticationSchemeImpl . LDAP_SEARCH_FILTER_USERNAME ) ) != ( - 1 ) ) { this . leftSearchFilter = searchFilterProp . substring ( 0 , searchFilterProp . indexOf ( LDAPAuthenticationSchemeImpl . LDAP_SEARCH_FILTER_USERNAME ) ) ; this . rightSearchFilter = searchFilterProp . substring ( ( ( searchFilterProp . indexOf ( LDAPAuthenticationSchemeImpl . LDAP_SEARCH_FILTER_USERNAME ) ) + ( ( int ) ( LDAPAuthenticationSchemeImpl . LDAP_SEARCH_FILTER_USERNAME . length ( ) ) ) ) ) ; } else { this . leftSearchFilter = ( ( "(&(" + searchFilterProp ) + ")" ) + "(objectClass=inetOrgPerson)(uid=" ; this . rightSearchFilter = "))" ; } if ( SanityManager . DEBUG ) { if ( SanityManager . DEBUG_ON ( AuthenticationTrace ) ) { PrintWriter iDbgStream = SanityManager . GET_DEBUG_STREAM ( ) ; iDbgStream . println ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "\n\n+<seq2seq4repair_space>LDAP<seq2seq4repair_space>Authentication<seq2seq4repair_space>Configuration:\n" + "<seq2seq4repair_space>-<seq2seq4repair_space>provider<seq2seq4repair_space>URL<seq2seq4repair_space>[" ) + ( this . providerURL ) ) + "]\n" ) + "<seq2seq4repair_space>-<seq2seq4repair_space>search<seq2seq4repair_space>base<seq2seq4repair_space>[" ) + ( this . searchBaseDN ) ) + "]\n" ) + "<seq2seq4repair_space>-<seq2seq4repair_space>search<seq2seq4repair_space>filter<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>[" ) + ( this . leftSearchFilter ) ) + "<uid>" ) + ( this . rightSearchFilter ) ) + "]\n" ) + "<seq2seq4repair_space>-<seq2seq4repair_space>use<seq2seq4repair_space>local<seq2seq4repair_space>DN<seq2seq4repair_space>[" ) + ( useUserPropertyAsDN ? "true" : "false" ) ) + "]\n" ) ) ; } } if ( SanityManager . DEBUG ) { if ( SanityManager . DEBUG_ON ( AuthenticationTrace ) ) { try { initDirContextEnv . put ( "com.sun.naming.ldap.trace.ber" , new FileOutputStream ( "CloudLDAP.out" ) ) ; } catch ( IOException ie ) { } } } } private String getDNFromUID ( String uid ) throws NamingException { } }

Fix:
if ( ( ldapServer . startsWith ( LDAPAuthenticationSchemeImpl . dfltLDAPURL ) ) || ( ldapServer . startsWith ( "ldaps:////" ) ) )