From 363abe75e33733aebdb139fdf421e87e4dc7a42a Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 22 Sep 2011 16:49:05 +0000
Subject: [PATCH] Fix OPENDJ-292: LDAP PTA NPE when base-dn or bind-dn not exist on secondary server
---
opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java b/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
index 4583814..270f87c 100644
--- a/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
+++ b/opends/src/server/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
@@ -74,6 +74,8 @@
// TODO: handle password policy response controls? AD?
// TODO: custom aliveness pings
// TODO: cache password
+ // TODO: handle idle timeouts (connection resets): implement retry logic in
+ // connection pools.
/**
* A simplistic load-balancer connection factory implementation using
@@ -113,6 +115,10 @@
incrementNextIndex();
return;
}
+ else if (lastException == null)
+ {
+ lastException = factory.lastException;
+ }
}
catch (final DirectoryException e)
{
@@ -265,7 +271,10 @@
private final class MonitoredConnectionFactory implements ConnectionFactory
{
private final ConnectionFactory factory;
+
+ // isAvailable acts as memory barrier for lastException.
private volatile boolean isAvailable = true;
+ private DirectoryException lastException = null;
@@ -305,7 +314,8 @@
{
TRACER.debugCaught(DebugLogLevel.ERROR, e);
}
- isAvailable = false;
+ lastException = e;
+ isAvailable = false; // publish lastException
throw e;
}
}
--
Gitblit v1.10.0