directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r924262 - in /directory/apacheds/trunk: core-jndi/src/main/java/org/apache/directory/server/core/jndi/ core-jndi/src/test/java/org/apache/directory/server/core/jndi/ i18n/src/main/java/org/apache/directory/server/i18n/ i18n/src/main/resourc...
Date Wed, 17 Mar 2010 13:01:21 GMT
Author: elecharny
Date: Wed Mar 17 13:01:17 2010
New Revision: 924262

URL: http://svn.apache.org/viewvc?rev=924262&view=rev
Log:
o Fixed Exceptions in core-JNDI
o Added some more new errors in i18n

Modified:
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/DeadContext.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
    directory/apacheds/trunk/core-jndi/src/test/java/org/apache/directory/server/core/jndi/LdapJndiPropertiesTest.java
    directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
    directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java?rev=924262&r1=924261&r2=924262&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java Wed Mar 17 13:01:17 2010
@@ -31,10 +31,13 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.jndi.JndiUtils;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
 
+import com.sun.jndi.ldap.LdapName;
+
 
 /**
  * A simplistic implementation of {@link AbstractContextFactory}.
@@ -49,7 +52,17 @@ public class CoreContextFactory implemen
     public synchronized Context getInitialContext( Hashtable env ) throws NamingException
     {
         env = ( Hashtable<String, Object> ) env.clone();
-        DN principalDn = new DN( getPrincipal( env ) );
+        DN principalDn = null;
+        
+        try
+        {
+            principalDn = new DN( getPrincipal( env ) );
+        }
+        catch ( LdapInvalidDnException lide )
+        {
+            throw new ConfigurationException( I18n.err( I18n.ERR_733, env ) );
+        }
+        
         byte[] credential = getCredential( env );
         String authentication = getAuthentication( env );
         String providerUrl = getProviderUrl( env );
@@ -70,7 +83,7 @@ public class CoreContextFactory implemen
         try
         {
             CoreSession session = service.getSession( principalDn, credential );
-            ctx = new ServerLdapContext( service, session, new DN( providerUrl ) );
+            ctx = new ServerLdapContext( service, session, new LdapName( providerUrl ) );
         }
         catch ( Exception e )
         {

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/DeadContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/DeadContext.java?rev=924262&r1=924261&r2=924262&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/DeadContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/DeadContext.java Wed Mar 17 13:01:17 2010
@@ -28,6 +28,7 @@ import javax.naming.NameClassPair;
 import javax.naming.NameParser;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
+import javax.naming.ServiceUnavailableException;
 import javax.naming.event.EventDirContext;
 import javax.naming.event.NamingListener;
 import javax.naming.directory.Attributes;
@@ -40,9 +41,6 @@ import javax.naming.ldap.ExtendedRequest
 import javax.naming.ldap.ExtendedResponse;
 import javax.naming.ldap.LdapContext;
 
-import org.apache.directory.shared.ldap.exception.LdapServiceUnavailableException;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-
 import javax.naming.Binding;
 
 
@@ -64,427 +62,427 @@ public class DeadContext implements Ldap
 
     public Control[] getConnectControls() throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Control[] getRequestControls() throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Control[] getResponseControls() throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void reconnect( Control[] connCtls ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void setRequestControls( Control[] requestControls ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public ExtendedResponse extendedOperation( ExtendedRequest request ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public LdapContext newInstance( Control[] requestControls ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Attributes getAttributes( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void modifyAttributes( String name, int mod_op, Attributes attrs ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Attributes getAttributes( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void modifyAttributes( Name name, int mod_op, Attributes attrs ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void modifyAttributes( Name name, ModificationItem[] mods ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
     public DirContext getSchema( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public DirContext getSchemaClassDefinition( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public DirContext getSchema( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public DirContext getSchemaClassDefinition( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void modifyAttributes( String name, ModificationItem[] mods ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<SearchResult> search( String name, Attributes matchingAttributes ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<SearchResult> search( Name name, Attributes matchingAttributes ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void bind( String name, Object obj, Attributes attrs ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void rebind( String name, Object obj, Attributes attrs ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void bind( Name name, Object obj, Attributes attrs ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void rebind( Name name, Object obj, Attributes attrs ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Attributes getAttributes( String name, String[] attrIds ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Attributes getAttributes( Name name, String[] attrIds ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public DirContext createSubcontext( String name, Attributes attrs ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public DirContext createSubcontext( Name name, Attributes attrs ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<SearchResult> search( String name, Attributes matchingAttributes, String[] attributesToReturn )
         throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<SearchResult> search( Name name, Attributes matchingAttributes, String[] attributesToReturn )
         throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<SearchResult> search( String name, String filter, SearchControls cons ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<SearchResult> search( Name name, String filter, SearchControls cons ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<SearchResult> search( String name, String filterExpr, Object[] filterArgs, SearchControls cons )
         throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<SearchResult> search( Name name, String filterExpr, Object[] filterArgs, SearchControls cons )
         throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void close() throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public String getNameInNamespace() throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void destroySubcontext( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void unbind( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Hashtable<String,Object>  getEnvironment() throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void destroySubcontext( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void unbind( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Object lookup( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Object lookupLink( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Object removeFromEnvironment( String propName ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void bind( String name, Object obj ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void rebind( String name, Object obj ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Object lookup( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Object lookupLink( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void bind( Name name, Object obj ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void rebind( Name name, Object obj ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void rename( String oldName, String newName ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Context createSubcontext( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Context createSubcontext( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void rename( Name oldName, Name newName ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NameParser getNameParser( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NameParser getNameParser( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<NameClassPair> list( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<Binding> listBindings( String name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<NameClassPair> list( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public NamingEnumeration<Binding> listBindings( Name name ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Object addToEnvironment( String propName, Object propVal ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public String composeName( String name, String prefix ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public Name composeName( Name name, Name prefix ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void addNamingListener( Name name, String s, SearchControls searchControls, NamingListener namingListener )
         throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void addNamingListener( String s, String s1, SearchControls searchControls, NamingListener namingListener )
         throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void addNamingListener( Name name, String s, Object[] objects, SearchControls searchControls,
         NamingListener namingListener ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void addNamingListener( String s, String s1, Object[] objects, SearchControls searchControls,
         NamingListener namingListener ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void addNamingListener( Name name, int i, NamingListener namingListener ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void addNamingListener( String s, int i, NamingListener namingListener ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public void removeNamingListener( NamingListener namingListener ) throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 
 
     public boolean targetMustExist() throws NamingException
     {
-        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+        throw new ServiceUnavailableException( EXCEPTION_MSG );
     }
 }

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java?rev=924262&r1=924261&r2=924262&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java Wed Mar 17 13:01:17 2010
@@ -33,6 +33,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 
@@ -83,7 +85,18 @@ class JavaLdapSupport
     static Object deserialize( ServerEntry serverEntry ) throws NamingException
     {
         ObjectInputStream in = null;
-        String className = ( String ) serverEntry.get( JCLASSNAME_ATTR ).getString();
+        String className = null;
+        
+        try
+        {
+            className = ( String ) serverEntry.get( JCLASSNAME_ATTR ).getString();
+        }
+        catch ( LdapInvalidAttributeValueException liave )
+        {
+            NamingException ne = new NamingException( I18n.err( I18n.ERR_479, className, liave.getLocalizedMessage() ) );
+            ne.setRootCause( liave );
+            throw ne;
+        }
 
         try
         {
@@ -121,7 +134,7 @@ class JavaLdapSupport
      * @return the object's serialized byte array form
      * @throws NamingException of the object cannot be serialized
      */
-    static byte[] serialize( Object obj ) throws NamingException
+    static byte[] serialize( Object obj ) throws LdapException
     {
         ByteArrayOutputStream bytesOut = null;
         ObjectOutputStream out = null;
@@ -135,8 +148,8 @@ class JavaLdapSupport
         }
         catch ( Exception e )
         {
-            NamingException ne = new NamingException( I18n.err( I18n.ERR_481, obj, e.getLocalizedMessage() ) );
-            ne.setRootCause( e );
+            LdapException ne = new LdapException( I18n.err( I18n.ERR_481, obj, e.getLocalizedMessage() ) );
+            //ne.setRootCause( e );
             throw ne;
         }
         finally
@@ -150,7 +163,7 @@ class JavaLdapSupport
             }
             catch ( IOException e )
             {
-                throw new NamingException( I18n.err( I18n.ERR_482 ) );
+                throw new LdapException( I18n.err( I18n.ERR_482 ) );
             }
         }
     }
@@ -164,7 +177,7 @@ class JavaLdapSupport
      * @param obj the object to serialize
      * @throws NamingException if the object cannot be serialized
      */
-    static void serialize( ServerEntry entry, Object obj, SchemaManager schemaManager ) throws NamingException
+    static void serialize( ServerEntry entry, Object obj, SchemaManager schemaManager ) throws LdapException
     {
         /* Let's add the object classes first:
          * objectClass: top

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java?rev=924262&r1=924261&r2=924262&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java Wed Mar 17 13:01:17 2010
@@ -22,12 +22,13 @@ package org.apache.directory.server.core
 
 import java.util.Hashtable;
 
+import javax.naming.ConfigurationException;
 import javax.naming.Context;
 import javax.naming.NamingException;
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
-import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
 
@@ -75,7 +76,7 @@ public class LdapJndiProperties
         }
         else if ( !( authentication instanceof String ) )
         {
-            throw new LdapConfigurationException( I18n.err( I18n.ERR_483, authentication.getClass(), 
+            throw new ConfigurationException( I18n.err( I18n.ERR_483, authentication.getClass(), 
                 Context.SECURITY_AUTHENTICATION ) );
         }
         else
@@ -102,7 +103,7 @@ public class LdapJndiProperties
     {
         if ( env == null )
         {
-            throw new LdapConfigurationException( "environment cannot be null" );
+            throw new ConfigurationException( "environment cannot be null" );
         }
 
         LdapJndiProperties props = new LdapJndiProperties();
@@ -117,14 +118,15 @@ public class LdapJndiProperties
         if ( !env.containsKey( Context.PROVIDER_URL ) )
         {
             String msg = I18n.err( I18n.ERR_484, Context.PROVIDER_URL );
-            throw new LdapConfigurationException( msg );
+            throw new ConfigurationException( msg );
         }
 
         String url = ( String ) env.get( Context.PROVIDER_URL );
+
         if ( url == null )
         {
             String msg = I18n.err( I18n.ERR_485, Context.PROVIDER_URL );
-            throw new LdapConfigurationException( msg );
+            throw new ConfigurationException( msg );
         }
 
         if ( url.trim().equals( "" ) )
@@ -133,7 +135,15 @@ public class LdapJndiProperties
         }
         else
         {
-            props.providerDn = new DN( url );
+            try
+            {
+                props.providerDn = new DN( url );
+            }
+            catch ( LdapInvalidDnException lide )
+            {
+                String msg = I18n.err( I18n.ERR_733, url );
+                throw new ConfigurationException( msg );
+            }
         }
 
         // -------------------------------------------------------------------
@@ -154,7 +164,7 @@ public class LdapJndiProperties
         }
         else if ( !( authentication instanceof String ) )
         {
-            throw new LdapConfigurationException( I18n.err( I18n.ERR_483, authentication.getClass(), 
+            throw new ConfigurationException( I18n.err( I18n.ERR_483, authentication.getClass(), 
                 Context.SECURITY_AUTHENTICATION ) );
         }
         else
@@ -188,7 +198,7 @@ public class LdapJndiProperties
 
         if ( principal == null && props.level == AuthenticationLevel.SIMPLE )
         {
-            throw new LdapConfigurationException( I18n.err( I18n.ERR_487, Context.SECURITY_PRINCIPAL ) );
+            throw new ConfigurationException( I18n.err( I18n.ERR_487, Context.SECURITY_PRINCIPAL ) );
         }
         else if ( principal == null && props.level == AuthenticationLevel.NONE )
         {
@@ -196,7 +206,7 @@ public class LdapJndiProperties
         }
         else if ( !( principal instanceof String ) )
         {
-            throw new LdapConfigurationException( I18n.err( I18n.ERR_483, principal.getClass(), Context.SECURITY_PRINCIPAL ) );
+            throw new ConfigurationException( I18n.err( I18n.ERR_483, principal.getClass(), Context.SECURITY_PRINCIPAL ) );
         }
         else if ( ( ( String ) principal ).trim().equals( "" ) )
         {
@@ -204,7 +214,16 @@ public class LdapJndiProperties
         }
         else
         {
-            props.bindDn = new DN( ( String ) principal );
+            try
+            {
+                props.providerDn = new DN( ( String ) principal );
+            }
+            catch ( LdapInvalidDnException lide )
+            {
+                String msg = I18n.err( I18n.ERR_733, principal );
+                throw new ConfigurationException( msg );
+            }
+
         }
         
 
@@ -217,7 +236,7 @@ public class LdapJndiProperties
             }
             else
             {
-                throw new LdapConfigurationException( I18n.err( I18n.ERR_483, obj.getClass(), SASL_AUTHID ) );
+                throw new ConfigurationException( I18n.err( I18n.ERR_483, obj.getClass(), SASL_AUTHID ) );
             }
             props.saslAuthId = ( String ) principal;
         }
@@ -228,7 +247,7 @@ public class LdapJndiProperties
 
         if ( props.level == AuthenticationLevel.SIMPLE && credobj == null )
         {
-            throw new LdapConfigurationException( I18n.err( I18n.ERR_489 ) );
+            throw new ConfigurationException( I18n.err( I18n.ERR_489 ) );
         }
         else if ( credobj != null )
         {
@@ -242,7 +261,7 @@ public class LdapJndiProperties
             }
             else
             {
-                throw new LdapConfigurationException( I18n.err( I18n.ERR_483, credobj.getClass(), Context.SECURITY_CREDENTIALS ) );
+                throw new ConfigurationException( I18n.err( I18n.ERR_483, credobj.getClass(), Context.SECURITY_CREDENTIALS ) );
             }
         }
 

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=924262&r1=924261&r2=924262&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Wed Mar 17 13:01:17 2010
@@ -33,9 +33,11 @@ import javax.naming.NameNotFoundExceptio
 import javax.naming.NameParser;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
+import javax.naming.NoPermissionException;
 import javax.naming.Reference;
 import javax.naming.Referenceable;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.SchemaViolationException;
 import javax.naming.directory.SearchControls;
 import javax.naming.event.EventContext;
 import javax.naming.event.NamingListener;
@@ -77,21 +79,23 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.cursor.SingletonCursor;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
-import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeTypeException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.jndi.JndiUtils;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.AVA;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.StringTools;
 
+import com.sun.jndi.ldap.LdapName;
+
 
 /**
  * A non-federated abstract Context implementation.
@@ -630,7 +634,7 @@ public abstract class ServerContext impl
      * 
      * @return the distinguished name of this Context's entry.
      */
-    protected Name getDn()
+    protected DN getDn()
     {
         return dn;
     }
@@ -703,7 +707,7 @@ public abstract class ServerContext impl
      */
     public Context createSubcontext( String name ) throws NamingException
     {
-        return createSubcontext( new DN( name ) );
+        return createSubcontext( new LdapName( name ) );
     }
 
 
@@ -712,9 +716,17 @@ public abstract class ServerContext impl
      */
     public Context createSubcontext( Name name ) throws NamingException
     {
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
         ServerEntry serverEntry = service.newEntry( target );
-        serverEntry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, JavaLdapSupport.JCONTAINER_ATTR );
+        
+        try
+        {
+            serverEntry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, JavaLdapSupport.JCONTAINER_ATTR );
+        }
+        catch ( LdapException le )
+        {
+            throw new SchemaViolationException( I18n.err( I18n.ERR_491, name) );
+        }
 
         // Now add the CN attribute, which is mandatory
         RDN rdn = target.getRdn();
@@ -728,13 +740,13 @@ public abstract class ServerContext impl
             else
             {
                 // No CN in the rdn, this is an error
-                throw new LdapSchemaViolationException( I18n.err( I18n.ERR_491, name), ResultCodeEnum.OBJECT_CLASS_VIOLATION );
+                throw new SchemaViolationException( I18n.err( I18n.ERR_491, name) );
             }
         }
         else
         {
             // No CN in the rdn, this is an error
-            throw new LdapSchemaViolationException( I18n.err( I18n.ERR_491, name), ResultCodeEnum.OBJECT_CLASS_VIOLATION );
+            throw new SchemaViolationException( I18n.err( I18n.ERR_491, name) );
         }
 
         /*
@@ -757,7 +769,7 @@ public abstract class ServerContext impl
         
         try
         {
-            ctx = new ServerLdapContext( service, session.getEffectivePrincipal(), target );
+            ctx = new ServerLdapContext( service, session.getEffectivePrincipal(), DN.toName( target ) );
         }
         catch ( Exception e )
         {
@@ -773,7 +785,7 @@ public abstract class ServerContext impl
      */
     public void destroySubcontext( String name ) throws NamingException
     {
-        destroySubcontext( new DN( name ) );
+        destroySubcontext( new LdapName( name ) );
     }
 
 
@@ -782,11 +794,11 @@ public abstract class ServerContext impl
      */
     public void destroySubcontext( Name name ) throws NamingException
     {
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
 
         if ( target.size() == 0 )
         {
-            throw new LdapNoPermissionException( I18n.err( I18n.ERR_492 ) );
+            throw new NoPermissionException( I18n.err( I18n.ERR_492 ) );
         }
 
         try
@@ -805,7 +817,7 @@ public abstract class ServerContext impl
      */
     public void bind( String name, Object obj ) throws NamingException
     {
-        bind( new DN( name ), obj );
+        bind( new LdapName( name ), obj );
     }
 
 
@@ -836,11 +848,20 @@ public abstract class ServerContext impl
         // First, use state factories to do a transformation
         DirStateFactory.Result res = DirectoryManager.getStateToBind( obj, name, this, env, null );
 
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
 
         // let's be sure that the Attributes is case insensitive
-        ServerEntry outServerEntry = ServerEntryUtils.toServerEntry( AttributeUtils.toCaseInsensitive( res
-            .getAttributes() ), target, service.getSchemaManager() );
+        ServerEntry outServerEntry = null;
+        
+        try
+        {
+            outServerEntry = ServerEntryUtils.toServerEntry( AttributeUtils.toCaseInsensitive( res
+                .getAttributes() ), target, service.getSchemaManager() );
+        }
+        catch ( LdapInvalidAttributeTypeException liate )
+        {
+            throw new NamingException( I18n.err( I18n.ERR_495, obj ) );
+        }
 
         if ( outServerEntry != null )
         {
@@ -886,7 +907,14 @@ public abstract class ServerContext impl
             {
                 for ( EntryAttribute serverAttribute : outServerEntry )
                 {
-                    serverEntry.put( serverAttribute );
+                    try
+                    {
+                        serverEntry.put( serverAttribute );
+                    }
+                    catch ( LdapException le )
+                    {
+                        throw new NamingException( I18n.err( I18n.ERR_495, obj ) );
+                    }
                 }
             }
 
@@ -894,7 +922,15 @@ public abstract class ServerContext impl
             injectRdnAttributeValues( target, serverEntry );
 
             // Serialize object into entry attributes and add it.
-            JavaLdapSupport.serialize( serverEntry, obj, service.getSchemaManager() );
+            try
+            { 
+                JavaLdapSupport.serialize( serverEntry, obj, service.getSchemaManager() );
+            }
+            catch ( LdapException le )
+            {
+                throw new NamingException( I18n.err( I18n.ERR_495, obj ) );
+            }
+            
             try
             {
                 doAddOperation( target, serverEntry );
@@ -907,14 +943,30 @@ public abstract class ServerContext impl
         else if ( obj instanceof DirContext )
         {
             // Grab attributes and merge with outAttrs
-            ServerEntry serverEntry = ServerEntryUtils.toServerEntry( ( ( DirContext ) obj ).getAttributes( "" ),
-                target, service.getSchemaManager() );
+            ServerEntry serverEntry = null;
+            
+            try
+            { 
+                serverEntry = ServerEntryUtils.toServerEntry( ( ( DirContext ) obj ).getAttributes( "" ),
+                    target, service.getSchemaManager() );
+            }
+            catch ( LdapInvalidAttributeTypeException liate )
+            {
+                throw new NamingException( I18n.err( I18n.ERR_495, obj ) );
+            }
 
             if ( ( outServerEntry != null ) && ( outServerEntry.size() > 0 ) )
             {
                 for ( EntryAttribute serverAttribute : outServerEntry )
                 {
-                    serverEntry.put( serverAttribute );
+                    try
+                    {                 
+                        serverEntry.put( serverAttribute );
+                    }
+                    catch ( LdapException le )
+                    {
+                        throw new NamingException( I18n.err( I18n.ERR_495, obj ) );
+                    }
                 }
             }
 
@@ -940,7 +992,7 @@ public abstract class ServerContext impl
      */
     public void rename( String oldName, String newName ) throws NamingException
     {
-        rename( new DN( oldName ), new DN( newName ) );
+        rename( new LdapName( oldName ), new LdapName( newName ) );
     }
 
 
@@ -949,19 +1001,37 @@ public abstract class ServerContext impl
      */
     public void rename( Name oldName, Name newName ) throws NamingException
     {
-        DN oldDn = buildTarget( oldName );
-        DN newDn = buildTarget( newName );
+        DN oldDn = buildTarget( DN.fromName( oldName ) );
+        DN newDn = buildTarget( DN.fromName( newName ) );
 
         if ( oldDn.size() == 0 )
         {
-            throw new LdapNoPermissionException( I18n.err( I18n.ERR_312 ) );
+            throw new NoPermissionException( I18n.err( I18n.ERR_312 ) );
         }
 
         // calculate parents
         DN oldParent = (DN)oldDn.clone();
-        oldParent.remove( oldDn.size() - 1 );
+        
+        try
+        {
+            oldParent.remove( oldDn.size() - 1 );
+        }
+        catch ( LdapInvalidDnException lide )
+        {
+            throw new NamingException( I18n.err( I18n.ERR_313, lide.getMessage() ) );
+        }
+        
         DN newParent = ( DN ) newDn.clone();
-        newParent.remove( newDn.size() - 1 );
+        
+        try
+        {
+            newParent.remove( newDn.size() - 1 );
+        }
+        catch ( LdapInvalidDnException lide )
+        {
+            throw new NamingException( I18n.err( I18n.ERR_313, lide.getMessage() ) );
+        }
+
 
         RDN oldRdn = oldDn.getRdn();
         RDN newRdn = newDn.getRdn();
@@ -1030,7 +1100,7 @@ public abstract class ServerContext impl
      */
     public void rebind( String name, Object obj ) throws NamingException
     {
-        rebind( new DN( name ), obj );
+        rebind( new LdapName( name ), obj );
     }
 
 
@@ -1039,7 +1109,7 @@ public abstract class ServerContext impl
      */
     public void rebind( Name name, Object obj ) throws NamingException
     {
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
         OperationManager operationManager = service.getOperationManager();
         
         try
@@ -1063,7 +1133,7 @@ public abstract class ServerContext impl
      */
     public void unbind( String name ) throws NamingException
     {
-        unbind( new DN( name ) );
+        unbind( new LdapName( name ) );
     }
 
 
@@ -1074,7 +1144,7 @@ public abstract class ServerContext impl
     {
         try
         {
-            doDeleteOperation( buildTarget( name ) );
+            doDeleteOperation( buildTarget( DN.fromName( name ) ) );
         }
         catch ( Exception e )
         {
@@ -1090,11 +1160,11 @@ public abstract class ServerContext impl
     {
         if ( StringTools.isEmpty( name ) )
         {
-            return lookup( DN.EMPTY_DN );
+            return lookup( new LdapName( "" ) );
         }
         else
         {
-            return lookup( new DN( name ) );
+            return lookup( new LdapName( name ) );
         }
     }
 
@@ -1105,7 +1175,7 @@ public abstract class ServerContext impl
     public Object lookup( Name name ) throws NamingException
     {
         Object obj;
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
 
         ServerEntry serverEntry = null;
 
@@ -1155,7 +1225,7 @@ public abstract class ServerContext impl
         
         try
         {
-            ctx = new ServerLdapContext( service, session.getEffectivePrincipal(), target );
+            ctx = new ServerLdapContext( service, session.getEffectivePrincipal(), DN.toName( target ) );
         }
         catch ( Exception e )
         {
@@ -1198,7 +1268,14 @@ public abstract class ServerContext impl
         {
             public Name parse( String name ) throws NamingException
             {
-                return new DN( name );
+                try
+                {
+                    return DN.toName( new DN( name ) );
+                }
+                catch ( LdapInvalidDnException lide )
+                {
+                    throw new InvalidNameException( lide.getMessage() );
+                }
             }
         };
     }
@@ -1212,13 +1289,20 @@ public abstract class ServerContext impl
      * 
      * @see javax.naming.Context#getNameParser(javax.naming.Name)
      */
-    public NameParser getNameParser( Name name ) throws NamingException
+    public NameParser getNameParser( final Name name ) throws NamingException
     {
         return new NameParser()
         {
-            public Name parse( String name ) throws NamingException
+            public Name parse( String n ) throws NamingException
             {
-                return new DN( name );
+                try
+                {
+                    return DN.toName( new DN( name.toString() ) );
+                }
+                catch ( LdapInvalidDnException lide )
+                {
+                    throw new InvalidNameException( lide.getMessage() );
+                }
             }
         };
     }
@@ -1231,7 +1315,7 @@ public abstract class ServerContext impl
         { "unchecked" })
     public NamingEnumeration list( String name ) throws NamingException
     {
-        return list( new DN( name ) );
+        return list( new LdapName( name ) );
     }
 
 
@@ -1244,7 +1328,7 @@ public abstract class ServerContext impl
     {
         try
         {
-            return new NamingEnumerationAdapter( doListOperation( buildTarget( name ) ) );
+            return new NamingEnumerationAdapter( doListOperation( buildTarget( DN.fromName( name ) ) ) );
         }
         catch ( Exception e )
         {
@@ -1261,7 +1345,7 @@ public abstract class ServerContext impl
         { "unchecked" })
     public NamingEnumeration listBindings( String name ) throws NamingException
     {
-        return listBindings( new DN( name ) );
+        return listBindings( new LdapName( name ) );
     }
 
 
@@ -1273,7 +1357,7 @@ public abstract class ServerContext impl
     public NamingEnumeration listBindings( Name name ) throws NamingException
     {
         // Conduct a special one level search at base for all objects
-        DN base = buildTarget( name );
+        DN base = buildTarget( DN.fromName( name ) );
         PresenceNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT );
         SearchControls ctls = new SearchControls();
         ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
@@ -1295,7 +1379,7 @@ public abstract class ServerContext impl
      */
     public String composeName( String name, String prefix ) throws NamingException
     {
-        return composeName( new DN( name ), new DN( prefix ) ).toString();
+        return composeName( new LdapName( name ), new LdapName( prefix ) ).toString();
     }
 
 
@@ -1327,7 +1411,7 @@ public abstract class ServerContext impl
          */
 
         // 1). Find the Dn for name and walk it from the head to tail
-        Name fqn = buildTarget( name );
+        DN fqn = buildTarget( DN.fromName( name ) );
         String head = prefix.get( 0 );
 
         // 2). Walk the fqn trying to match for the head of the prefix
@@ -1336,12 +1420,19 @@ public abstract class ServerContext impl
             // match found end loop
             if ( fqn.get( 0 ).equalsIgnoreCase( head ) )
             {
-                return fqn;
+                return DN.toName( fqn );
             }
             else
             // 2). Remove name components from the Dn until a match 
             {
-                fqn.remove( 0 );
+                try
+                {
+                    fqn.remove( 0 );
+                }
+                catch ( LdapInvalidDnException lide )
+                {
+                    throw new NamingException( lide.getMessage() );
+                }
             }
         }
 
@@ -1365,7 +1456,7 @@ public abstract class ServerContext impl
             criteria.setFilter( filter );
             criteria.setScope( SearchScope.getSearchScope( scope ) );
             criteria.setAliasDerefMode( AliasDerefMode.getEnum( env ) );
-            criteria.setBase( buildTarget( name ) );
+            criteria.setBase( buildTarget( DN.fromName( name ) ) );
             
             service.getEventService().addListener( listener );
             listeners.put( namingListener, listener );
@@ -1379,7 +1470,7 @@ public abstract class ServerContext impl
 
     public void addNamingListener( String name, int scope, NamingListener namingListener ) throws NamingException
     {
-        addNamingListener( new DN( name ), scope, namingListener );
+        addNamingListener( new LdapName( name ), scope, namingListener );
     }
 
 
@@ -1431,12 +1522,20 @@ public abstract class ServerContext impl
      * @throws InvalidNameException if relativeName is not a valid name in
      *      the LDAP namespace.
      */
-    DN buildTarget( Name relativeName ) throws InvalidNameException
+    DN buildTarget( DN relativeName ) throws NamingException
     {
         DN target = ( DN ) dn.clone();
 
         // Add to left hand side of cloned DN the relative name arg
-        target.addAllNormalized( target.size(), relativeName );
+        try
+        {
+            target.addAllNormalized( target.size(), relativeName );
+        }
+        catch (LdapInvalidDnException lide )
+        {
+            throw new InvalidNameException( lide.getMessage() );
+        }
+        
         return target;
     }
 }

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=924262&r1=924261&r2=924262&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Wed Mar 17 13:01:17 2010
@@ -35,6 +35,9 @@ import javax.naming.Referenceable;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.InvalidAttributeIdentifierException;
+import javax.naming.directory.InvalidAttributeValueException;
+import javax.naming.directory.InvalidAttributesException;
 import javax.naming.directory.InvalidSearchFilterException;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
@@ -59,6 +62,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeTypeException;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
@@ -75,6 +80,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.StringTools;
 
+import com.sun.jndi.ldap.LdapName;
+
 
 /**
  * The DirContext implementation for the Server Side JNDI LDAP provider.
@@ -120,7 +127,7 @@ public abstract class ServerDirContext e
     // ------------------------------------------------------------------------
 
     
-    public ServerDirContext( DirectoryService service, CoreSession session, DN bindDn ) throws Exception
+    public ServerDirContext( DirectoryService service, CoreSession session, Name bindDn ) throws Exception
     {
         super( service, session, bindDn );
     }
@@ -131,7 +138,7 @@ public abstract class ServerDirContext e
      */
     public Attributes getAttributes( String name ) throws NamingException
     {
-        return getAttributes( new DN( name ) );
+        return getAttributes( new LdapName( name ) );
     }
 
 
@@ -144,7 +151,7 @@ public abstract class ServerDirContext e
         
         try
         {
-            attrs = ServerEntryUtils.toBasicAttributes( doLookupOperation( buildTarget( name ) ) );
+            attrs = ServerEntryUtils.toBasicAttributes( doLookupOperation( buildTarget( DN.fromName( name ) ) ) );
         }
         catch ( Exception e )
         {
@@ -161,7 +168,7 @@ public abstract class ServerDirContext e
      */
     public Attributes getAttributes( String name, String[] attrIds ) throws NamingException
     {
-        return getAttributes( new DN( name ), attrIds );
+        return getAttributes( new LdapName( name ), attrIds );
     }
 
 
@@ -174,7 +181,7 @@ public abstract class ServerDirContext e
         Attributes attrs = null;
         try
         {
-            attrs = ServerEntryUtils.toBasicAttributes( doLookupOperation( buildTarget( name ), attrIds ) );
+            attrs = ServerEntryUtils.toBasicAttributes( doLookupOperation( buildTarget( DN.fromName( name ) ), attrIds ) );
         }
         catch ( Exception e )
         {
@@ -191,7 +198,7 @@ public abstract class ServerDirContext e
      */
     public void modifyAttributes( String name, int modOp, Attributes attrs ) throws NamingException
     {
-        modifyAttributes( new DN( name ), modOp, AttributeUtils.toCaseInsensitive( attrs ) );
+        modifyAttributes( new LdapName( name ), modOp, AttributeUtils.toCaseInsensitive( attrs ) );
     }
 
 
@@ -214,19 +221,28 @@ public abstract class ServerDirContext e
             }
         }
 
-        List<Modification> newMods = ServerEntryUtils.convertToServerModification( 
-            modItems, 
-            getDirectoryService().getSchemaManager() );
+        List<Modification> newMods = null;
+        
+        try
+        {
+            newMods = ServerEntryUtils.convertToServerModification( 
+                modItems, 
+                getDirectoryService().getSchemaManager() );
+        }
+        catch ( LdapException le )
+        {
+            throw new InvalidAttributesException( le.getMessage() );
+        }
 
         try
         {
             if ( name instanceof DN )
             {
-                doModifyOperation( buildTarget( name ), newMods );
+                doModifyOperation( buildTarget( DN.fromName( name ) ), newMods );
             }
             else
             {
-                doModifyOperation( buildTarget( new DN( name ) ), newMods );
+                doModifyOperation( buildTarget( (DN)name ), newMods );
             }
         }
         catch( Exception e )
@@ -242,7 +258,7 @@ public abstract class ServerDirContext e
      */
     public void modifyAttributes( String name, ModificationItem[] mods ) throws NamingException
     {
-        modifyAttributes( new DN( name ), mods );
+        modifyAttributes( new LdapName( name ), mods );
     }
 
 
@@ -252,11 +268,21 @@ public abstract class ServerDirContext e
      */
     public void modifyAttributes( Name name, ModificationItem[] mods ) throws NamingException
     {
-        List<Modification> newMods = ServerEntryUtils
-            .toServerModification( mods, getDirectoryService().getSchemaManager() );
+        List<Modification> newMods;
+        
         try
         {
-            doModifyOperation( buildTarget( new DN( name ) ), newMods );
+            newMods = ServerEntryUtils
+                .toServerModification( mods, getDirectoryService().getSchemaManager() );
+        }
+        catch ( LdapException le )
+        {
+            throw new InvalidAttributesException( le.getMessage() );
+        }
+        
+        try
+        {
+            doModifyOperation( buildTarget( DN.fromName( name ) ), newMods );
         }
         catch ( Exception e )
         {
@@ -271,12 +297,21 @@ public abstract class ServerDirContext e
      */
     public void modifyAttributes( Name name, List<ModificationItem> mods ) throws NamingException
     {
-        List<Modification> newMods = ServerEntryUtils
-            .convertToServerModification( mods, 
-                getDirectoryService().getSchemaManager() );
+        List<Modification> newMods;
         try
         {
-            doModifyOperation( buildTarget( new DN( name ) ), newMods );
+            newMods = ServerEntryUtils
+                .convertToServerModification( mods, 
+                    getDirectoryService().getSchemaManager() );
+        }
+        catch ( LdapException le )
+        {
+            throw new InvalidAttributesException( le.getMessage() );
+        }
+        
+        try
+        {
+            doModifyOperation( buildTarget( DN.fromName( name ) ), newMods );
         }
         catch ( Exception e )
         {
@@ -291,7 +326,7 @@ public abstract class ServerDirContext e
      */
     public void bind( String name, Object obj, Attributes attrs ) throws NamingException
     {
-        bind( new DN( name ), obj, AttributeUtils.toCaseInsensitive( attrs ) );
+        bind( new LdapName( name ), obj, AttributeUtils.toCaseInsensitive( attrs ) );
     }
 
 
@@ -313,10 +348,22 @@ public abstract class ServerDirContext e
             return;
         }
 
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
 
-        ServerEntry serverEntry = ServerEntryUtils.toServerEntry( AttributeUtils.toCaseInsensitive( attrs ), target,
-            getDirectoryService().getSchemaManager() );
+        ServerEntry serverEntry = null;
+        
+        try
+        {
+            serverEntry = ServerEntryUtils.toServerEntry( AttributeUtils.toCaseInsensitive( attrs ), target,
+                getDirectoryService().getSchemaManager() );
+        }
+        catch ( LdapInvalidAttributeTypeException e1 )
+        {
+        }
+        catch ( LdapException le )
+        {
+            throw new InvalidAttributesException( le.getMessage() );
+        }
 
         // No object binding so we just add the attributes
         if ( null == obj )
@@ -335,8 +382,17 @@ public abstract class ServerDirContext e
 
         // First, use state factories to do a transformation
         DirStateFactory.Result res = DirectoryManager.getStateToBind( obj, name, this, getEnvironment(), attrs );
-        ServerEntry outServerEntry = ServerEntryUtils.toServerEntry( 
-            res.getAttributes(), target, getDirectoryService().getSchemaManager() );
+        ServerEntry outServerEntry = null;
+        
+        try
+        {
+            outServerEntry = ServerEntryUtils.toServerEntry( 
+                res.getAttributes(), target, getDirectoryService().getSchemaManager() );
+        }
+        catch ( LdapInvalidAttributeTypeException le )
+        {
+            throw new InvalidAttributesException( le.getMessage() );
+        }
 
         if ( outServerEntry != serverEntry )
         {
@@ -346,7 +402,15 @@ public abstract class ServerDirContext e
             {
                 for ( EntryAttribute attribute : outServerEntry )
                 {
-                    clone.put( attribute );
+                    try
+                    {
+                        clone.put( attribute );
+                    }
+                    catch ( LdapException e )
+                    {
+                        // TODO Auto-generated catch block
+                        e.printStackTrace();
+                    }
                 }
             }
 
@@ -359,6 +423,7 @@ public abstract class ServerDirContext e
             {
                 JndiUtils.wrap( e );
             }
+            
             return;
         }
 
@@ -383,14 +448,22 @@ public abstract class ServerDirContext e
             {
                 for ( EntryAttribute attribute : outServerEntry )
                 {
-                    clone.put( attribute );
+                    try
+                    {
+                        clone.put( attribute );
+                    }
+                    catch ( LdapException le )
+                    {
+                        throw new InvalidAttributesException( le.getMessage() );
+                    }
                 }
             }
 
-            // Serialize object into entry attributes and add it.
-            JavaLdapSupport.serialize( serverEntry, obj, getDirectoryService().getSchemaManager() );
             try
             {
+                // Serialize object into entry attributes and add it.
+                JavaLdapSupport.serialize( serverEntry, obj, getDirectoryService().getSchemaManager() );
+                
                 // setup the op context
                 doAddOperation( target, clone );
             }
@@ -402,14 +475,30 @@ public abstract class ServerDirContext e
         else if ( obj instanceof DirContext )
         {
             // Grab attributes and merge with outAttrs
-            ServerEntry entry = ServerEntryUtils.toServerEntry( ( ( DirContext ) obj ).getAttributes( "" ), target,
-                getDirectoryService().getSchemaManager() );
+            ServerEntry entry = null;
+            
+            try
+            {
+                entry = ServerEntryUtils.toServerEntry( ( ( DirContext ) obj ).getAttributes( "" ), target,
+                    getDirectoryService().getSchemaManager() );
+            }
+            catch ( LdapInvalidAttributeTypeException liate )
+            {
+                throw new InvalidAttributeIdentifierException( liate.getMessage() );
+            }
 
             if ( ( outServerEntry != null ) && ( outServerEntry.size() > 0 ) )
             {
                 for ( EntryAttribute attribute : outServerEntry )
                 {
-                    entry.put( attribute );
+                    try
+                    {
+                        entry.put( attribute );
+                    }
+                    catch ( LdapException le )
+                    {
+                        throw new InvalidAttributeValueException( le.getMessage() );
+                    }
                 }
             }
 
@@ -436,7 +525,7 @@ public abstract class ServerDirContext e
      */
     public void rebind( String name, Object obj, Attributes attrs ) throws NamingException
     {
-        rebind( new DN( name ), obj, AttributeUtils.toCaseInsensitive( attrs ) );
+        rebind( new LdapName( name ), obj, AttributeUtils.toCaseInsensitive( attrs ) );
     }
 
 
@@ -446,7 +535,7 @@ public abstract class ServerDirContext e
      */
     public void rebind( Name name, Object obj, Attributes attrs ) throws NamingException
     {
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
 
         try
         {
@@ -470,9 +559,8 @@ public abstract class ServerDirContext e
      */
     public DirContext createSubcontext( String name, Attributes attrs ) throws NamingException
     {
-        DN dn = new DN( name );
         Attributes attributes = AttributeUtils.toCaseInsensitive( attrs );
-        return createSubcontext( dn, attributes );
+        return createSubcontext( new LdapName( name ), attributes );
     }
 
 
@@ -487,7 +575,7 @@ public abstract class ServerDirContext e
             return ( DirContext ) super.createSubcontext( name );
         }
 
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
         RDN rdn = target.getRdn( target.size() - 1 );
 
         attrs = AttributeUtils.toCaseInsensitive( attrs );
@@ -547,7 +635,7 @@ public abstract class ServerDirContext e
         
         try
         {
-            ctx = new ServerLdapContext( getService(), getSession().getEffectivePrincipal(), target );
+            ctx = new ServerLdapContext( getService(), getSession().getEffectivePrincipal(), DN.toName( target ) );
         }
         catch ( Exception e )
         {
@@ -605,7 +693,7 @@ public abstract class ServerDirContext e
      */
     public NamingEnumeration<SearchResult> search( String name, Attributes matchingAttributes ) throws NamingException
     {
-        return search( new DN( name ), matchingAttributes, null );
+        return search( new LdapName( name ), matchingAttributes, null );
     }
 
 
@@ -626,7 +714,7 @@ public abstract class ServerDirContext e
     public NamingEnumeration<SearchResult> search( String name, Attributes matchingAttributes,
         String[] attributesToReturn ) throws NamingException
     {
-        return search( new DN( name ), AttributeUtils.toCaseInsensitive( matchingAttributes ), attributesToReturn );
+        return search( new LdapName( name ), AttributeUtils.toCaseInsensitive( matchingAttributes ), attributesToReturn );
     }
 
 
@@ -638,7 +726,7 @@ public abstract class ServerDirContext e
         throws NamingException
     {
         SearchControls ctls = new SearchControls();
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
 
         // If we need to return specific attributes add em to the SearchControls
         if ( null != attributesToReturn )
@@ -762,7 +850,7 @@ public abstract class ServerDirContext e
     public NamingEnumeration<SearchResult> search( String name, String filter, SearchControls cons )
         throws NamingException
     {
-        return search( new DN( name ), filter, cons );
+        return search( new LdapName( name ), filter, cons );
     }
 
 
@@ -780,7 +868,7 @@ public abstract class ServerDirContext e
     public NamingEnumeration<SearchResult> search( Name name, ExprNode filter, SearchControls cons )
         throws NamingException
     {
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
         try
         {
@@ -802,7 +890,7 @@ public abstract class ServerDirContext e
         throws NamingException
     {
         ExprNode filterNode;
-        DN target = buildTarget( name );
+        DN target = buildTarget( DN.fromName( name ) );
 
         try
         {
@@ -837,7 +925,7 @@ public abstract class ServerDirContext e
     public NamingEnumeration<SearchResult> search( String name, String filterExpr, Object[] filterArgs,
         SearchControls cons ) throws NamingException
     {
-        return search( new DN( name ), filterExpr, filterArgs, cons );
+        return search( new LdapName( name ), filterExpr, filterArgs, cons );
     }
 
 
@@ -938,7 +1026,7 @@ public abstract class ServerDirContext e
             criteria.setFilter( filter );
             criteria.setScope( SearchScope.getSearchScope( searchControls.getSearchScope() ) );
             criteria.setAliasDerefMode( AliasDerefMode.getEnum( getEnvironment() ) );
-            criteria.setBase( buildTarget( name ) );
+            criteria.setBase( buildTarget( DN.fromName( name ) ) );
             
             getDirectoryService().getEventService().addListener( listener );
             getListeners().put( namingListener, listener );
@@ -953,7 +1041,7 @@ public abstract class ServerDirContext e
     public void addNamingListener( String name, String filter, SearchControls searchControls,
         NamingListener namingListener ) throws NamingException
     {
-        addNamingListener( new DN( name ), filter, searchControls, namingListener );
+        addNamingListener( new LdapName( name ), filter, searchControls, namingListener );
     }
 
 
@@ -995,6 +1083,6 @@ public abstract class ServerDirContext e
     public void addNamingListener( String name, String filter, Object[] objects, SearchControls searchControls,
         NamingListener namingListener ) throws NamingException
     {
-        addNamingListener( new DN( name ), filter, objects, searchControls, namingListener );
+        addNamingListener( new LdapName( name ), filter, objects, searchControls, namingListener );
     }
 }

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=924262&r1=924261&r2=924262&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Wed Mar 17 13:01:17 2010
@@ -22,7 +22,9 @@ package org.apache.directory.server.core
 
 import java.util.Hashtable;
 
+import javax.naming.Name;
 import javax.naming.NamingException;
+import javax.naming.directory.InvalidAttributeIdentifierException;
 import javax.naming.ldap.Control;
 import javax.naming.ldap.ExtendedRequest;
 import javax.naming.ldap.ExtendedResponse;
@@ -38,11 +40,14 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.jndi.JndiUtils;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.StringTools;
 
+import com.sun.jndi.ldap.LdapName;
+
 
 /**
  * An implementation of a JNDI LdapContext.
@@ -74,13 +79,13 @@ public class ServerLdapContext extends S
      * @param service the directory service core
      * @throws NamingException if there are problems instantiating 
      */
-    public ServerLdapContext( DirectoryService service, LdapPrincipal principal, DN dn ) throws Exception
+    public ServerLdapContext( DirectoryService service, LdapPrincipal principal, Name dn ) throws Exception
     {
         super( service, principal, dn );
     }
 
 
-    public ServerLdapContext( DirectoryService service, CoreSession session, DN bindDn ) throws Exception
+    public ServerLdapContext( DirectoryService service, CoreSession session, Name bindDn ) throws Exception
     {
         super( service, session, bindDn );
     }
@@ -103,14 +108,16 @@ public class ServerLdapContext extends S
     public LdapContext newInstance( Control[] requestControls ) throws NamingException
     {
         ServerLdapContext ctx = null;
+        
         try
         {
-            ctx = new ServerLdapContext( getService(), getSession().getEffectivePrincipal(), ( DN ) getDn() );
+            ctx = new ServerLdapContext( getService(), getSession().getEffectivePrincipal(), DN.toName( getDn() ) );
         }
         catch ( Exception e )
         {
             JndiUtils.wrap( e );
         }
+        
         ctx.setRequestControls( requestControls );
         return ctx;
     }
@@ -183,7 +190,16 @@ public class ServerLdapContext extends S
     {
         Value<?> val = null;
         
-        AttributeType attributeType = getService().getSchemaManager().lookupAttributeTypeRegistry( oid );
+        AttributeType attributeType = null;
+        
+        try
+        {
+            attributeType = getService().getSchemaManager().lookupAttributeTypeRegistry( oid );
+        }
+        catch ( LdapException le )
+        {
+            throw new InvalidAttributeIdentifierException( le.getMessage() );
+        }
         
         // make sure we add the request controls to operation
         if ( attributeType.getSyntax().isHumanReadable() )
@@ -275,7 +291,7 @@ public class ServerLdapContext extends S
         
         try
         {
-            ctx = new ServerLdapContext( getService(), getSession().getEffectivePrincipal(), new DN() );
+            ctx = new ServerLdapContext( getService(), getSession().getEffectivePrincipal(), new LdapName( "" ) );
         }
         catch ( Exception e )
         {

Modified: directory/apacheds/trunk/core-jndi/src/test/java/org/apache/directory/server/core/jndi/LdapJndiPropertiesTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/test/java/org/apache/directory/server/core/jndi/LdapJndiPropertiesTest.java?rev=924262&r1=924261&r2=924262&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/test/java/org/apache/directory/server/core/jndi/LdapJndiPropertiesTest.java (original)
+++ directory/apacheds/trunk/core-jndi/src/test/java/org/apache/directory/server/core/jndi/LdapJndiPropertiesTest.java Wed Mar 17 13:01:17 2010
@@ -22,12 +22,12 @@ package org.apache.directory.server.core
 
 import java.util.Hashtable;
 
+import javax.naming.ConfigurationException;
 import javax.naming.Context;
 
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.directory.server.core.jndi.LdapJndiProperties;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
-import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
 
@@ -51,7 +51,7 @@ public class LdapJndiPropertiesTest
             LdapJndiProperties.getLdapJndiProperties( new Hashtable<String,Object>() );
             fail( "should never get here" );
         }
-        catch ( LdapConfigurationException e )
+        catch ( ConfigurationException e )
         {
         }
     }
@@ -65,7 +65,7 @@ public class LdapJndiPropertiesTest
             LdapJndiProperties.getLdapJndiProperties( null );
             fail( "should never get here" );
         }
-        catch ( LdapConfigurationException e )
+        catch ( ConfigurationException e )
         {
         }
     }
@@ -107,7 +107,7 @@ public class LdapJndiPropertiesTest
             LdapJndiProperties.getLdapJndiProperties( env );
             fail( "should never get here" );
         }
-        catch ( LdapConfigurationException e )
+        catch ( ConfigurationException e )
         {
         }
     }

Modified: directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java?rev=924262&r1=924261&r2=924262&view=diff
==============================================================================
--- directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java (original)
+++ directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java Wed Mar 17 13:01:17 2010
@@ -351,7 +351,7 @@ public class I18n
     public static String ERR_310 = "ERR_310";
     public static String ERR_311 = "ERR_311";
     public static String ERR_312 = "ERR_312";
-    // public static String ERR_313 = "ERR_313";
+    public static String ERR_313 = "ERR_313";
     public static String ERR_314 = "ERR_314";
     public static String ERR_315 = "ERR_315";
     public static String ERR_316 = "ERR_316";
@@ -771,6 +771,7 @@ public class I18n
     public static String ERR_730 = "ERR_730";
     public static String ERR_731 = "ERR_731";
     public static String ERR_732 = "ERR_732";
+    public static String ERR_733 = "ERR_733";
 
 
     /**

Modified: directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties?rev=924262&r1=924261&r2=924262&view=diff
==============================================================================
--- directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties (original)
+++ directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties Wed Mar 17 13:01:17 2010
@@ -334,7 +334,7 @@ ERR_309=Bad value for the OID {0}
 ERR_310=The change log must be enabled to revert to previous log revisions.
 ERR_311=There must be at least one tag to revert to the latest tag.
 ERR_312=can't rename the rootDSE
-# ERR_313=
+ERR_313=Invalid operation on Name {0}
 ERR_314=revision must be less than the current revision
 ERR_315=cannot create an entry under a referral when the Context.REFERRAL is set to 'ignore'
 ERR_316=Directory service is not started.
@@ -754,3 +754,4 @@ ERR_729=You didn't correctly set col nam
 ERR_730=Unrecognized mode.
 ERR_731=Unrecognized FilterDialog command: {0}
 ERR_732=Cannot process a Request while binding
+ERR_733=Principal is not a valid Name : {0}
\ No newline at end of file



Mime
View raw message