DefaultDirContextValidator class doesn't close NamingEnumeration searchResults.
As a consequence, the LDAP connection associated with the DirContext can't be closed when requested by the pool.
It's conform to the documentation : https://docs.oracle.com/javase/tutorial/jndi/ldap/close.html
"If the Context instance is sharing a connection with other Context and unterminated NamingEnumeration instances, the connection will not be closed until close() has been invoked on all such Context and NamingEnumeration instances"
DefaultDirContextValidator should close the NamingEnumeration searchResults in a finally block :
NamingEnumeration<SearchResult> = null;
...
try {
searchResults = dirContext.search(this.base, this.filter, this.searchControls);
...
} finally {
if (searchResults != null) {
try {
searchResults.close();
} catch (Exception e) {
}
}
}
DefaultDirContextValidatorclass doesn't closeNamingEnumerationsearchResults.As a consequence, the LDAP connection associated with the
DirContextcan't be closed when requested by the pool.It's conform to the documentation : https://docs.oracle.com/javase/tutorial/jndi/ldap/close.html
"If the Context instance is sharing a connection with other Context and unterminated NamingEnumeration instances, the connection will not be closed until close() has been invoked on all such Context and NamingEnumeration instances"
DefaultDirContextValidatorshould close theNamingEnumerationsearchResults in a finally block :