-
Bug
-
Resolution: Done
-
Critical
-
7.1.0.DR12
Coverity static analysis found 8 occurence of Closeable object LdapIdentity not closing properly.
https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=9564393&defectInstanceId=2359307&mergedDefectId=1400389
https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=9564393&defectInstanceId=2359304&mergedDefectId=1400388
https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=9564393&defectInstanceId=2359309&mergedDefectId=1400387
https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=9564393&defectInstanceId=2359306&mergedDefectId=1400386
https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=9564393&defectInstanceId=2359311&mergedDefectId=1400385
https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=9564393&defectInstanceId=2359312&mergedDefectId=1400384
https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=9564393&defectInstanceId=2359313&mergedDefectId=1400383
https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=9564393&defectInstanceId=2359303&mergedDefectId=1400382
LdapIdentity in close() method just close provided dirContext. LdapIdentity does not create dirContext by itself. So it looks to me it is no necessary to implement Closeable in LdapIdentity, as code where dirContext was created should be responsible for closing it (and according to coverity it is closed properly everywhere).
private class LdapIdentity implements Closeable { private final String name; private final DirContext dirContext; private final String distinguishedName; private final SearchResult entry; LdapIdentity(String name, DirContext dirContext, String distinguishedName, SearchResult entry) { this.name = name; this.dirContext = dirContext; this.distinguishedName = distinguishedName; this.entry = entry; } String getName() { return this.name; } DirContext getDirContext() { return this.dirContext; } String getDistinguishedName() { return this.distinguishedName; } SearchResult getEntry() { return this.entry; } @Override public void close() throws IOException { try { dirContext.close(); } catch (NamingException e) { log.debug("LdapSecurityRealm failed to close DirContext", e); } } }
- is cloned by
-
ELY-965 Coverity static analysis, Resource leak, LdapsecurityRealm (Elytron)
- Resolved
- is incorporated by
-
JBEAP-8862 Upgrade WildFly Elytron to 1.1.0.Beta26
- Closed