summaryrefslogtreecommitdiffstats
path: root/base/server/cmscore/src
diff options
context:
space:
mode:
authorFraser Tweedale <frase@frase.id.au>2015-04-13 02:00:10 -0400
committerFraser Tweedale <frase@frase.id.au>2015-04-13 20:07:17 -0400
commitbdd5cc759f5d1642986330a4c29ccfa131ab034f (patch)
tree2c0ead39b982b710f5b16019c446158b0e3b0da4 /base/server/cmscore/src
parentd83f6889018870150b9ef0b102c4f4af24bbb95f (diff)
downloadpki-bdd5cc759f5d1642986330a4c29ccfa131ab034f.tar.gz
pki-bdd5cc759f5d1642986330a4c29ccfa131ab034f.tar.xz
pki-bdd5cc759f5d1642986330a4c29ccfa131ab034f.zip
Consolidate profile persistent search try/catch blocks
Diffstat (limited to 'base/server/cmscore/src')
-rw-r--r--base/server/cmscore/src/com/netscape/cmscore/profile/LDAPProfileSubsystem.java30
1 files changed, 15 insertions, 15 deletions
diff --git a/base/server/cmscore/src/com/netscape/cmscore/profile/LDAPProfileSubsystem.java b/base/server/cmscore/src/com/netscape/cmscore/profile/LDAPProfileSubsystem.java
index c7963498d..0c390be58 100644
--- a/base/server/cmscore/src/com/netscape/cmscore/profile/LDAPProfileSubsystem.java
+++ b/base/server/cmscore/src/com/netscape/cmscore/profile/LDAPProfileSubsystem.java
@@ -268,7 +268,7 @@ public class LDAPProfileSubsystem
LDAPPersistSearchControl persistCtrl =
new LDAPPersistSearchControl(op, false, true, true);
- LDAPConnection conn;
+ LDAPConnection conn = null;
CMS.debug("Profile change monitor: starting.");
@@ -276,16 +276,6 @@ public class LDAPProfileSubsystem
forgetAllProfiles();
try {
conn = dbFactory.getConn();
- } catch (ELdapException e) {
- CMS.debug("Profile change monitor: failed to get LDAPConnection. Retrying in 1 second.");
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- continue;
- }
- try {
LDAPSearchConstraints cons = conn.getSearchConstraints();
cons.setServerControls(persistCtrl);
cons.setBatchSize(1);
@@ -334,13 +324,23 @@ public class LDAPProfileSubsystem
readProfile(entry);
}
}
+ } catch (ELdapException e) {
+ CMS.debug("Profile change monitor: failed to get LDAPConnection. Retrying in 1 second.");
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
} catch (LDAPException e) {
CMS.debug("Profile change monitor: Caught exception: " + e.toString());
} finally {
- try {
- dbFactory.returnConn(conn);
- } catch (Exception e) {
- CMS.debug("Profile change monitor: Error releasing the LDAPConnection" + e.toString());
+ if (conn != null) {
+ try {
+ dbFactory.returnConn(conn);
+ conn = null;
+ } catch (Exception e) {
+ CMS.debug("Profile change monitor: Error releasing the LDAPConnection" + e.toString());
+ }
}
}
}