directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 55549 - in incubator/directory/eve/trunk/backend/core: . src/java/org/apache/eve/jndi/exception src/java/org/apache/eve/jndi/ibs src/test/org/apache/eve/jndi
Date Tue, 26 Oct 2004 00:44:11 GMT
Author: akarasulu
Date: Mon Oct 25 17:44:10 2004
New Revision: 55549

Added:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/exception/
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/exception/EveNameNotFoundException.java
Modified:
   incubator/directory/eve/trunk/backend/core/project.properties
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/EveExceptionService.java
   incubator/directory/eve/trunk/backend/core/src/test/org/apache/eve/jndi/DestroyContextTest.java
Log:
fixed a bug in exception handling service

Modified: incubator/directory/eve/trunk/backend/core/project.properties
==============================================================================
--- incubator/directory/eve/trunk/backend/core/project.properties	(original)
+++ incubator/directory/eve/trunk/backend/core/project.properties	Mon Oct 25 17:44:10 2004
@@ -1,4 +1,4 @@
-maven.junit.fork=yes
+maven.junit.fork=no
 
 maven.javadoc.private=true
 maven.javadoc.overview=src/java/org/apache/eve/schema/overview.html

Added: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/exception/EveNameNotFoundException.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/exception/EveNameNotFoundException.java
Mon Oct 25 17:44:10 2004
@@ -0,0 +1,38 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.jndi.exception;
+
+
+import javax.naming.NameNotFoundException;
+
+import org.apache.eve.exception.EveException;
+import org.apache.ldap.common.message.ResultCodeEnum;
+
+
+/**
+ * Document this class.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class EveNameNotFoundException extends NameNotFoundException implements EveException
+{
+    public ResultCodeEnum getResultCode()
+    {
+        return ResultCodeEnum.NOSUCHOBJECT;
+    }
+}

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/EveExceptionService.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/EveExceptionService.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/ibs/EveExceptionService.java
Mon Oct 25 17:44:10 2004
@@ -22,9 +22,9 @@
 import javax.naming.directory.Attributes;
 
 import org.apache.eve.jndi.*;
+import org.apache.eve.jndi.exception.EveNameNotFoundException;
 import org.apache.eve.RootNexus;
 import org.apache.eve.exception.EveAttributeInUseException;
-import org.apache.eve.exception.EveInterceptorException;
 
 
 /**
@@ -70,18 +70,30 @@
 
         if ( invocation.getState() == InvocationStateEnum.PREINVOCATION )
         {
-            try
+            if ( nexus.hasEntry( normName ) )
             {
-                if ( nexus.hasEntry( normName ) )
-                {
-                    NamingException ne = new EveAttributeInUseException();
-                    invocation.setBeforeFailure( new EveAttributeInUseException() );
-                    throw ne;
-                }
+                NamingException ne = new EveAttributeInUseException();
+                invocation.setBeforeFailure( ne );
+                throw ne;
             }
-            catch ( NamingException e )
+        }
+    }
+
+
+    /**
+     * @see BaseInterceptor#lookup(javax.naming.Name)
+     */
+    protected void lookup( Name dn ) throws NamingException
+    {
+        Invocation invocation = getInvocation();
+
+        if ( invocation.getState() == InvocationStateEnum.PREINVOCATION )
+        {
+            if ( ! nexus.hasEntry( dn ) )
             {
-                throw new EveInterceptorException( this, invocation, e );
+                NamingException ne = new EveNameNotFoundException();
+                invocation.setBeforeFailure( ne );
+                throw ne;
             }
         }
     }

Modified: incubator/directory/eve/trunk/backend/core/src/test/org/apache/eve/jndi/DestroyContextTest.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/test/org/apache/eve/jndi/DestroyContextTest.java
(original)
+++ incubator/directory/eve/trunk/backend/core/src/test/org/apache/eve/jndi/DestroyContextTest.java
Mon Oct 25 17:44:10 2004
@@ -19,6 +19,8 @@
 
 import javax.naming.NamingException;
 
+import org.apache.eve.jndi.exception.EveNameNotFoundException;
+
 
 /**
  * Tests the destroyContext methods of the provider.
@@ -58,6 +60,7 @@
         }
         catch( NamingException e )
         {
+            assertTrue( e instanceof EveNameNotFoundException );
         }
 
         /*
@@ -72,6 +75,7 @@
         }
         catch( NamingException e )
         {
+            assertTrue( e instanceof EveNameNotFoundException );
         }
 
         /*
@@ -86,6 +90,7 @@
         }
         catch( NamingException e )
         {
+            assertTrue( e instanceof EveNameNotFoundException );
         }
 
 
@@ -101,6 +106,7 @@
         }
         catch( NamingException e )
         {
+            assertTrue( e instanceof EveNameNotFoundException );
         }
     }
 

Mime
View raw message