This is an automated email from the ASF dual-hosted git repository.
pmouawad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git
The following commit(s) were added to refs/heads/master by this push:
new 4ecda65 Close ctx in finally
4ecda65 is described below
commit 4ecda65e5babf120300c3e06f2a08f735a0fd3a9
Author: pmouawad <[email protected]>
AuthorDate: Fri Jul 12 15:06:31 2019 +0200
Close ctx in finally
---
.../org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
b/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
index 162e5f9..e1646bd 100644
---
a/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
+++
b/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
@@ -623,11 +623,13 @@ public class LDAPExtSampler extends AbstractSampler
implements TestStateListener
*
**************************************************************************/
private void addTest(DirContext dirContext, SampleResult res) throws
NamingException {
+ DirContext ctx = null;
try {
res.sampleStart();
- DirContext ctx = LdapExtClient.createTest(dirContext,
getUserAttributes(), getBaseEntryDN());
- ctx.close(); // the createTest() method creates an extra context
which needs to be closed
+ ctx = LdapExtClient.createTest(dirContext, getUserAttributes(),
getBaseEntryDN());
} finally {
+ // the createTest() method creates an extra context which needs to
be closed
+ LdapExtClient.disconnect(ctx);
res.sampleEnd();
}
}
@@ -669,7 +671,7 @@ public class LDAPExtSampler extends AbstractSampler
implements TestStateListener
if(log.isWarnEnabled()) {
log.warn("Closing previous context for thread: {}",
getThreadName());
}
- ctx.close();
+ LdapExtClient.disconnect(ctx);
}
try {
res.sampleStart();