You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2010/03/19 18:56:47 UTC
svn commit: r925355 -
/directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java
Author: kayyagari
Date: Fri Mar 19 17:56:47 2010
New Revision: 925355
URL: http://svn.apache.org/viewvc?rev=925355&view=rev
Log:
o added a ReferralException implementation to handle the referral related exceptions
o uncommented the if condition related to referral exception handling
Modified:
directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java
Modified: directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java?rev=925355&r1=925354&r2=925355&view=diff
==============================================================================
--- directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java (original)
+++ directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java Fri Mar 19 17:56:47 2010
@@ -19,9 +19,12 @@
*/
package org.apache.directory.shared.ldap.jndi;
+import java.util.Hashtable;
+
import javax.naming.AuthenticationException;
import javax.naming.AuthenticationNotSupportedException;
import javax.naming.CommunicationException;
+import javax.naming.Context;
import javax.naming.ContextNotEmptyException;
import javax.naming.InvalidNameException;
import javax.naming.NameAlreadyBoundException;
@@ -29,6 +32,7 @@ import javax.naming.NameNotFoundExceptio
import javax.naming.NamingException;
import javax.naming.NoPermissionException;
import javax.naming.OperationNotSupportedException;
+import javax.naming.ReferralException;
import javax.naming.ServiceUnavailableException;
import javax.naming.TimeLimitExceededException;
import javax.naming.directory.AttributeInUseException;
@@ -59,6 +63,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.exception.LdapOperationErrorException;
import org.apache.directory.shared.ldap.exception.LdapOtherException;
import org.apache.directory.shared.ldap.exception.LdapProtocolErrorException;
+import org.apache.directory.shared.ldap.exception.LdapReferralException;
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
import org.apache.directory.shared.ldap.exception.LdapServiceUnavailableException;
import org.apache.directory.shared.ldap.exception.LdapTimeLimitExceededException;
@@ -219,12 +224,10 @@ public class JndiUtils
{
ne = new CommunicationException( t.getLocalizedMessage() );
}
- /* Special case ...
else if ( t instanceof LdapReferralException )
{
- ne = new LdapReferralException( t.getLocalizedMessage() );
+ ne = new WrappedReferralException( ( LdapReferralException ) t );
}
- */
else if ( t instanceof LdapSchemaViolationException )
{
ne = new SchemaViolationException( t.getLocalizedMessage() );
@@ -245,9 +248,52 @@ public class JndiUtils
{
ne = new NamingException( t.getLocalizedMessage() );
}
-
ne.setRootCause( t );
throw ne;
}
-
}
+
+// a ReferralException around the LdapReferralException to be used in tests
+class WrappedReferralException extends ReferralException
+{
+ private LdapReferralException lre;
+
+ public WrappedReferralException( LdapReferralException lre )
+ {
+ this.lre = lre;
+ }
+
+ @Override
+ public boolean skipReferral()
+ {
+ return lre.skipReferral();
+ }
+
+
+ @Override
+ public void retryReferral()
+ {
+ lre.retryReferral();
+ }
+
+
+ @Override
+ public Object getReferralInfo()
+ {
+ return lre.getReferralInfo();
+ }
+
+
+ @Override
+ public Context getReferralContext( Hashtable<?, ?> env ) throws NamingException
+ {
+ return lre.getReferralContext( env );
+ }
+
+
+ @Override
+ public Context getReferralContext() throws NamingException
+ {
+ return lre.getReferralContext();
+ }
+}
\ No newline at end of file