directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1422849 - in /directory: apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/ apacheds/trunk/core-api/src/test/java/org/apache/dir...
Date Mon, 17 Dec 2012 11:13:25 GMT
Author: elecharny
Date: Mon Dec 17 11:13:19 2012
New Revision: 1422849

URL: http://svn.apache.org/viewvc?rev=1422849&view=rev
Log:
Refactoring the Cursor exception handling
o Created a root class for cursor exceptions CursorException
o The Cursor close(), isCloased() and close(Exception) method in cursor are not anymore throwing an Exception 
o The Cursor get() method now throws either a CloseException or a IOException
o Fixed all the cursor implementations accordingly
o Fixed the handling of CursorException in the SearchHandler

Added:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorException.java   (with props)
Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayTreeCursor.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlSingletonOrOrderedSetCursor.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeCursor.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsWrapperCursor.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaJournalCursor.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/EntryCursorImpl.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/SearchCursorImpl.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/AbstractCursor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ClosureMonitor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/Cursor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorClosedException.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/DefaultClosureMonitor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EmptyCursor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/InconsistentCursorStateException.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/InvalidCursorPositionException.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ListCursor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SingletonCursor.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java Mon Dec 17 11:13:19 2012
@@ -21,11 +21,14 @@
 package org.apache.directory.server.core.api;
 
 
+import java.io.IOException;
 import java.util.Iterator;
 
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.ClosureMonitor;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
+import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.SearchCursor;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -114,7 +117,10 @@ public class EntryToResponseCursor exten
     }
 
 
-    public void close() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -125,7 +131,10 @@ public class EntryToResponseCursor exten
     }
 
 
-    public void close( Exception e ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public void close( Exception e )
     {
         if ( IS_DEBUG )
         {
@@ -142,7 +151,10 @@ public class EntryToResponseCursor exten
     }
 
 
-    public Response get() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public Response get() throws CursorException, IOException
     {
         Entry entry = wrapped.get();
         SearchResultEntry se = new SearchResultEntryImpl( messageId );
@@ -163,7 +175,10 @@ public class EntryToResponseCursor exten
     }
 
 
-    public boolean isClosed() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isClosed()
     {
         return wrapped.isClosed();
     }

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java Mon Dec 17 11:13:19 2012
@@ -20,6 +20,7 @@
 package org.apache.directory.server.core.api.filtering;
 
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -258,7 +259,7 @@ public class BaseEntryFilteringCursor ex
     /**
      * {@inheritDoc}
      */
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -273,7 +274,7 @@ public class BaseEntryFilteringCursor ex
     /**
      * {@inheritDoc}
      */
-    public void close( Exception reason ) throws Exception
+    public void close( Exception reason )
     {
         if ( IS_DEBUG )
         {
@@ -312,7 +313,7 @@ public class BaseEntryFilteringCursor ex
     /**
      * {@inheritDoc}
      */
-    public Entry get() throws Exception
+    public Entry get() throws InvalidCursorPositionException, IOException
     {
         if ( available() )
         {
@@ -326,7 +327,7 @@ public class BaseEntryFilteringCursor ex
     /**
      * {@inheritDoc}
      */
-    public boolean isClosed() throws Exception
+    public boolean isClosed()
     {
         return wrapped.isClosed();
     }

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java Mon Dec 17 11:13:19 2012
@@ -29,6 +29,7 @@ import org.apache.directory.shared.i18n.
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.ClosureMonitor;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.slf4j.Logger;
@@ -390,7 +391,7 @@ public class CursorList extends Abstract
     /**
      * {@inheritDoc}
      */
-    public Entry get() throws Exception
+    public Entry get() throws CursorException, IOException
     {
         if ( ( index < start ) || ( index >= end ) )
         {
@@ -456,7 +457,7 @@ public class CursorList extends Abstract
     }
 
 
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -467,7 +468,7 @@ public class CursorList extends Abstract
     }
 
 
-    public void close( Exception reason ) throws Exception
+    public void close( Exception reason )
     {
         if ( IS_DEBUG )
         {
@@ -497,7 +498,10 @@ public class CursorList extends Abstract
     }
 
 
-    public boolean isClosed() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isClosed()
     {
         return closed;
     }

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java Mon Dec 17 11:13:19 2012
@@ -20,10 +20,12 @@
 package org.apache.directory.server.core.api;
 
 
+import java.io.IOException;
 import java.util.NoSuchElementException;
 
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.ClosureMonitor;
+import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
@@ -49,7 +51,7 @@ public class MockCursor extends Abstract
     }
 
 
-    public void close() throws Exception
+    public void close()
     {
         ii = count;
     }
@@ -103,13 +105,19 @@ public class MockCursor extends Abstract
     }
 
 
-    public Entry get() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public Entry get() throws InvalidCursorPositionException, IOException
     {
         return new DefaultEntry( schemaManager );
     }
 
 
-    public boolean isClosed() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isClosed()
     {
         return false;
     }
@@ -147,7 +155,10 @@ public class MockCursor extends Abstract
     }
 
 
-    public void close( Exception reason ) throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public void close( Exception reason )
     {
     }
 

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayTreeCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayTreeCursor.java (original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayTreeCursor.java Mon Dec 17 11:13:19 2012
@@ -20,7 +20,10 @@
 package org.apache.directory.server.core.avltree;
 
 
+import java.io.IOException;
+
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -183,7 +186,7 @@ public class ArrayTreeCursor<E> extends 
     /**
      * {@inheritDoc}
      */
-    public E get() throws Exception
+    public E get() throws CursorException, IOException
     {
         checkNotClosed( "get" );
 
@@ -310,7 +313,7 @@ public class ArrayTreeCursor<E> extends 
     /**
      * {@inheritDoc}
      */
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -324,7 +327,7 @@ public class ArrayTreeCursor<E> extends 
     /**
      * {@inheritDoc}
      */
-    public void close( Exception reason ) throws Exception
+    public void close( Exception reason )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlSingletonOrOrderedSetCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlSingletonOrOrderedSetCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlSingletonOrOrderedSetCursor.java (original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlSingletonOrOrderedSetCursor.java Mon Dec 17 11:13:19 2012
@@ -20,9 +20,11 @@
 package org.apache.directory.server.core.avltree;
 
 
+import java.io.IOException;
 import java.util.Comparator;
 
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 import org.slf4j.Logger;
@@ -130,7 +132,10 @@ public class AvlSingletonOrOrderedSetCur
     }
 
 
-    public Tuple<K, SingletonOrOrderedSet<V>> get() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public Tuple<K, SingletonOrOrderedSet<V>> get() throws CursorException, IOException
     {
         checkNotClosed( "get" );
 
@@ -305,7 +310,7 @@ public class AvlSingletonOrOrderedSetCur
     /**
      * {@inheritDoc}
      */
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -319,7 +324,7 @@ public class AvlSingletonOrOrderedSetCur
     /**
      * {@inheritDoc}
      */
-    public void close( Exception reason ) throws Exception
+    public void close( Exception reason )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeCursor.java (original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeCursor.java Mon Dec 17 11:13:19 2012
@@ -20,7 +20,10 @@
 package org.apache.directory.server.core.avltree;
 
 
+import java.io.IOException;
+
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -153,7 +156,10 @@ public class AvlTreeCursor<E> extends Ab
     }
 
 
-    public E get() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public E get() throws CursorException, IOException
     {
         checkNotClosed( "get" );
 
@@ -260,7 +266,7 @@ public class AvlTreeCursor<E> extends Ab
     /**
      * {@inheritDoc}
      */
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -274,7 +280,7 @@ public class AvlTreeCursor<E> extends Ab
     /**
      * {@inheritDoc}
      */
-    public void close( Exception reason ) throws Exception
+    public void close( Exception reason )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsWrapperCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsWrapperCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsWrapperCursor.java (original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsWrapperCursor.java Mon Dec 17 11:13:19 2012
@@ -20,7 +20,10 @@
 package org.apache.directory.server.core.avltree;
 
 
+import java.io.IOException;
+
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 import org.slf4j.Logger;
@@ -116,7 +119,10 @@ public class AvlTreeMapNoDupsWrapperCurs
     }
 
 
-    public Tuple<K, V> get() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public Tuple<K, V> get() throws CursorException, IOException
     {
         if ( wrapped.available() )
         {
@@ -153,7 +159,7 @@ public class AvlTreeMapNoDupsWrapperCurs
     }
 
 
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -164,7 +170,7 @@ public class AvlTreeMapNoDupsWrapperCurs
     }
 
 
-    public void close( Exception reason ) throws Exception
+    public void close( Exception reason )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java (original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java Mon Dec 17 11:13:19 2012
@@ -19,8 +19,11 @@
 package org.apache.directory.server.core.avltree;
 
 
+import java.io.IOException;
+
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 import org.slf4j.Logger;
@@ -207,7 +210,10 @@ public class KeyTupleAvlCursor<K, V> ext
     }
 
 
-    public Tuple<K, V> get() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public Tuple<K, V> get() throws CursorException, IOException
     {
         checkNotClosed( "get()" );
         if ( valueAvailable )
@@ -222,7 +228,7 @@ public class KeyTupleAvlCursor<K, V> ext
     /**
      * {@inheritDoc}
      */
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -241,7 +247,7 @@ public class KeyTupleAvlCursor<K, V> ext
     /**
      * {@inheritDoc}
      */
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java Mon Dec 17 11:13:19 2012
@@ -27,6 +27,7 @@ import jdbm.helper.TupleBrowser;
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 import org.slf4j.Logger;
@@ -370,7 +371,7 @@ public class DupsContainerCursor<K, V> e
     /**
      * {@inheritDoc}
      */
-    public Tuple<K, DupsContainer<V>> get() throws Exception
+    public Tuple<K, DupsContainer<V>> get() throws CursorException, IOException
     {
         checkNotClosed( "get()" );
 
@@ -387,7 +388,7 @@ public class DupsContainerCursor<K, V> e
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -403,7 +404,7 @@ public class DupsContainerCursor<K, V> e
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java Mon Dec 17 11:13:19 2012
@@ -20,12 +20,15 @@
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
 
+import java.io.IOException;
+
 import jdbm.btree.BTree;
 
 import org.apache.directory.server.core.avltree.ArrayTree;
 import org.apache.directory.server.core.avltree.ArrayTreeCursor;
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 import org.slf4j.Logger;
@@ -469,7 +472,10 @@ class DupsCursor<K, V> extends AbstractC
     }
 
 
-    public Tuple<K, V> get() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public Tuple<K, V> get() throws CursorException, IOException
     {
         checkNotClosed( "get()" );
 
@@ -486,7 +492,7 @@ class DupsCursor<K, V> extends AbstractC
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -507,7 +513,7 @@ class DupsCursor<K, V> extends AbstractC
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java Mon Dec 17 11:13:19 2012
@@ -19,6 +19,7 @@
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
 
+import java.io.IOException;
 import java.util.Comparator;
 
 import jdbm.btree.BTree;
@@ -26,6 +27,7 @@ import jdbm.helper.Tuple;
 import jdbm.helper.TupleBrowser;
 
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -211,8 +213,10 @@ public class KeyBTreeCursor<E> extends A
     }
 
 
-    @SuppressWarnings("unchecked")
-    public E get() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public E get() throws CursorException, IOException
     {
         checkNotClosed( "get()" );
 
@@ -229,7 +233,7 @@ public class KeyBTreeCursor<E> extends A
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -245,7 +249,7 @@ public class KeyBTreeCursor<E> extends A
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java Mon Dec 17 11:13:19 2012
@@ -19,6 +19,7 @@
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
 
+import java.io.IOException;
 import java.util.Comparator;
 
 import jdbm.btree.BTree;
@@ -26,6 +27,7 @@ import jdbm.helper.TupleBrowser;
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 import org.slf4j.Logger;
@@ -315,7 +317,7 @@ public class KeyTupleBTreeCursor<K, V> e
     /**
      * {@inheritDoc}
      */
-    public Tuple<K, V> get() throws Exception
+    public Tuple<K, V> get() throws CursorException, IOException
     {
         checkNotClosed( "get()" );
 
@@ -332,7 +334,7 @@ public class KeyTupleBTreeCursor<K, V> e
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -348,7 +350,7 @@ public class KeyTupleBTreeCursor<K, V> e
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java Mon Dec 17 11:13:19 2012
@@ -25,6 +25,7 @@ import jdbm.helper.TupleBrowser;
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 import org.slf4j.Logger;
@@ -250,7 +251,10 @@ class NoDupsCursor<K, V> extends Abstrac
     }
 
 
-    public Tuple<K, V> get() throws Exception
+    /**
+     * {@inheritDoc}
+     */
+    public Tuple<K, V> get() throws CursorException, IOException
     {
         checkNotClosed( "get()" );
         if ( valueAvailable )
@@ -266,7 +270,7 @@ class NoDupsCursor<K, V> extends Abstrac
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -282,7 +286,7 @@ class NoDupsCursor<K, V> extends Abstrac
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchTimeLimitingMonitor.java Mon Dec 17 11:13:19 2012
@@ -68,32 +68,26 @@ public class SearchTimeLimitingMonitor i
     }
 
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.directory.server.core.cursor.ClosureMonitor#checkNotClosed()
+    /**
+     * {@inheritDoc}
      */
-    // False positive, we want to keep the comment
-    @SuppressWarnings("PMD.CollapsibleIfStatements")
-    public void checkNotClosed() throws Exception
+    public void checkNotClosed() throws CursorClosedException
     {
-        if ( System.currentTimeMillis() > startTime + millisToLive )
+        if ( ( System.currentTimeMillis() > startTime + millisToLive ) && !closed )
         {
             // state check needed to "try" not to overwrite exception (lack of 
             // synchronization may still allow overwriting but who cares that 
             // much
-            if ( !closed )
-            {
-                // not going to sync because who cares if it takes a little 
-                // longer to stop but we need to set cause before toggling 
-                // closed state or else check for closure can throw null cause 
-                cause = new LdapTimeLimitExceededException();
-                closed = true;
-            }
+            // not going to sync because who cares if it takes a little 
+            // longer to stop but we need to set cause before toggling 
+            // closed state or else check for closure can throw null cause 
+            cause = new LdapTimeLimitExceededException();
+            closed = true;
         }
 
         if ( closed )
         {
-            throw cause;
+            throw new CursorClosedException( cause.getMessage(), cause );
         }
     }
 

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java Mon Dec 17 11:13:19 2012
@@ -47,6 +47,7 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.shared.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator;
 import org.apache.directory.shared.ldap.extras.controls.SyncRequestValue;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.model.cursor.CursorClosedException;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Value;
@@ -1621,6 +1622,11 @@ public class SearchRequestHandler extend
          */
         ResultCodeEnum code;
 
+        if ( e instanceof CursorClosedException )
+        {
+            e = (Exception)((CursorClosedException)e).getCause();
+        }
+
         if ( e instanceof LdapOperationException )
         {
             code = ( ( LdapOperationException ) e ).getResultCode();

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaJournalCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaJournalCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaJournalCursor.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaJournalCursor.java Mon Dec 17 11:13:19 2012
@@ -28,6 +28,7 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 import org.apache.directory.shared.ldap.model.message.controls.ChangeType;
 import org.slf4j.Logger;
@@ -140,7 +141,7 @@ public class ReplicaJournalCursor extend
     /**
      * {@inheritDoc}
      */
-    public ReplicaEventMessage get() throws Exception
+    public ReplicaEventMessage get() throws CursorException
     {
         return qualifiedEvtMsg;
     }
@@ -237,7 +238,7 @@ public class ReplicaJournalCursor extend
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -253,7 +254,7 @@ public class ReplicaJournalCursor extend
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchLimitsIT.java Mon Dec 17 11:13:19 2012
@@ -158,7 +158,14 @@ public class SearchLimitsIT extends Abst
         getLdapServer().setMaxTimeLimit( LdapServer.NO_TIME_LIMIT );
         delayInterceptor.setDelayMillis( 500 );
     
-        getActorsWithLimit( "(objectClass=*)", 499, LdapServer.NO_SIZE_LIMIT );
+        try
+        {
+            getActorsWithLimit( "(objectClass=*)", 499, LdapServer.NO_SIZE_LIMIT );
+        }
+        catch ( Exception e )
+        {
+            throw e;
+        }
     }
     
     

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/EntryCursorImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/EntryCursorImpl.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/EntryCursorImpl.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/EntryCursorImpl.java Mon Dec 17 11:13:19 2012
@@ -21,8 +21,11 @@
 package org.apache.directory.ldap.client.api;
 
 
+import java.io.IOException;
+
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.model.cursor.CursorException;
 import org.apache.directory.shared.ldap.model.cursor.EntryCursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.SearchCursor;
@@ -126,21 +129,29 @@ public class EntryCursorImpl extends Abs
     /**
      * {@inheritDoc}
      */
-    public Entry get() throws Exception
+    public Entry get() throws CursorException, IOException
     {
         if ( !searchCursor.available() )
         {
             throw new InvalidCursorPositionException();
         }
 
-        do
+        try
         {
-            if ( response instanceof SearchResultEntry )
+            do
             {
-                return ( ( SearchResultEntry ) response ).getEntry();
+                if ( response instanceof SearchResultEntry )
+                {
+                    return ( ( SearchResultEntry ) response ).getEntry();
+                }
             }
+            while ( next() && !( response instanceof SearchResultDone ) );
         }
-        while ( next() && !( response instanceof SearchResultDone ) );
+        catch ( Exception e )
+        {
+            throw new CursorException( e.getMessage(), e );
+        }
+
 
         return null;
     }
@@ -168,7 +179,7 @@ public class EntryCursorImpl extends Abs
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -183,7 +194,7 @@ public class EntryCursorImpl extends Abs
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java Mon Dec 17 11:13:19 2012
@@ -676,13 +676,18 @@ public class LdapNetworkConnection exten
         // Release the connector
         connectorMutex.lock();
 
-        if ( connector != null )
+        try
         {
-            connector.dispose();
-            connector = null;
+            if ( connector != null )
+            {
+                connector.dispose();
+                connector = null;
+            }
+        }
+        finally
+        {
+            connectorMutex.unlock();
         }
-
-        connectorMutex.unlock();
 
         // Reset the messageId
         messageId.set( 0 );
@@ -3501,13 +3506,18 @@ public class LdapNetworkConnection exten
 
         connectorMutex.lock();
 
-        if ( connector != null )
+        try
         {
-            connector.dispose();
-            connector = null;
+            if ( connector != null )
+            {
+                connector.dispose();
+                connector = null;
+            }
+        }
+        finally
+        {
+            connectorMutex.unlock();
         }
-
-        connectorMutex.unlock();
 
         clearMaps();
 

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/SearchCursorImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/SearchCursorImpl.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/SearchCursorImpl.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/SearchCursorImpl.java Mon Dec 17 11:13:19 2012
@@ -21,6 +21,7 @@
 package org.apache.directory.ldap.client.api;
 
 
+import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.directory.ldap.client.api.future.SearchFuture;
@@ -153,7 +154,7 @@ public class SearchCursorImpl extends Ab
     /**
      * {@inheritDoc}
      */
-    public Response get() throws Exception
+    public Response get() throws InvalidCursorPositionException, IOException
     {
         if ( !available() )
         {
@@ -186,7 +187,7 @@ public class SearchCursorImpl extends Ab
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -201,7 +202,7 @@ public class SearchCursorImpl extends Ab
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/AbstractCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/AbstractCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/AbstractCursor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/AbstractCursor.java Mon Dec 17 11:13:19 2012
@@ -54,9 +54,9 @@ public abstract class AbstractCursor<E> 
      * Check that the cursor is not closed before executing an operation.
      * 
      * @param operation The operation we try to execute
-     * @throws Exception If there is a problem during the check
+     * @throws CursorClosedException If there is a problem during the check
      */
-    public final void checkNotClosed( String operation ) throws Exception
+    public final void checkNotClosed( String operation ) throws CursorClosedException
     {
         monitor.checkNotClosed();
     }
@@ -65,7 +65,7 @@ public abstract class AbstractCursor<E> 
     /**
      * {@inheritDoc}
      */
-    public boolean isClosed() throws Exception
+    public boolean isClosed()
     {
         return monitor.isClosed();
     }
@@ -74,7 +74,7 @@ public abstract class AbstractCursor<E> 
     /**
      * {@inheritDoc}
      */
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         monitor.close( cause );
     }
@@ -83,7 +83,7 @@ public abstract class AbstractCursor<E> 
     /**
      * {@inheritDoc}
      */
-    public void close() throws Exception
+    public void close()
     {
         monitor.close();
     }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ClosureMonitor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ClosureMonitor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ClosureMonitor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ClosureMonitor.java Mon Dec 17 11:13:19 2012
@@ -66,9 +66,9 @@ public interface ClosureMonitor
      * Checks if state of this ClosureMonitor is set to closed and if so, 
      * throws the causing Exception.
      *
-     * @throws Exception the cause of the closure
+     * @throws CursorClosedException the cause of the closure
      */
-    void checkNotClosed() throws Exception;
+    void checkNotClosed() throws CursorClosedException;
 
 
     /**

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/Cursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/Cursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/Cursor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/Cursor.java Mon Dec 17 11:13:19 2012
@@ -18,6 +18,8 @@
  */
 package org.apache.directory.shared.ldap.model.cursor;
 
+import java.io.IOException;
+
 
 /**
  * A Cursor for bidirectional traversal over elements in a dataSet. Cursors
@@ -172,9 +174,8 @@ public interface Cursor<E> extends Itera
      * fail with exceptions if and only if the cursor is in the closed state.
      *
      * @return true if this Cursor is closed, false otherwise
-     * @throws Exception if there are problems determining the cursor's closed state
      */
-    boolean isClosed() throws Exception;
+    boolean isClosed();
 
 
     /**
@@ -208,20 +209,18 @@ public interface Cursor<E> extends Itera
      * instead of creating new objects on each advance.
      *
      * @return the object at the current position
-     * @throws Exception if the object at this Cursor's current position
+     * @throws CursorException if the object at this Cursor's current position
      * cannot be retrieved, or if this Cursor is closed
      */
-    E get() throws Exception;
+    E get() throws CursorException, IOException;
 
 
     /**
      * Closes this Cursor and frees any resources it my have allocated.
      * Repeated calls to this method after this Cursor has already been
      * called should not fail with exceptions.
-     *
-     * @throws Exception if for some reason this Cursor could not be closed
      */
-    void close() throws Exception;
+    void close();
 
 
     /**
@@ -232,9 +231,8 @@ public interface Cursor<E> extends Itera
      * CursorClosedException.
      *
      * @param reason exception thrown when this Cursor is accessed after close
-     * @throws Exception if for some reason this Cursor could not be closed
      */
-    void close( Exception reason ) throws Exception;
+    void close( Exception reason );
 
 
     /**

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorClosedException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorClosedException.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorClosedException.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorClosedException.java Mon Dec 17 11:13:19 2012
@@ -25,7 +25,7 @@ package org.apache.directory.shared.ldap
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CursorClosedException extends Exception
+public class CursorClosedException extends CursorException
 {
     /** The serialVersion UID */
     private static final long serialVersionUID = -5723233489761854394L;
@@ -51,4 +51,16 @@ public class CursorClosedException exten
     {
         super( message );
     }
+
+
+    /**
+     * Creates a new instance of CursorClosedException.
+     *
+     * @param message The associated message
+     * @param cause The original cause
+     */
+    public CursorClosedException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
 }

Added: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorException.java?rev=1422849&view=auto
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorException.java (added)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorException.java Mon Dec 17 11:13:19 2012
@@ -0,0 +1,73 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.shared.ldap.model.cursor;
+
+
+/**
+ * An class for exceptions which add Cursor specific information to
+ * Exceptions.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class CursorException extends Exception
+{
+    /** The serial version UUID */
+    private static final long serialVersionUID = 1L;
+
+
+    /**
+     * Creates a new instance of CursorException.
+     */
+    public CursorException()
+    {
+    }
+
+
+    /**
+     * Creates a new instance of CursorException.
+     *
+     * @param explanation The message associated with the exception
+     */
+    public CursorException( String explanation )
+    {
+        super( explanation );
+    }
+
+
+    /**
+     * Creates a new instance of LdapException.
+     */
+    public CursorException( Throwable cause )
+    {
+        super( cause );
+    }
+
+
+    /**
+     * Creates a new instance of CursorException.
+     *
+     * @param explanation The message associated with the exception
+     * @param cause The root cause for this exception
+     */
+    public CursorException( String explanation, Throwable cause )
+    {
+        super( explanation, cause );
+    }
+}

Propchange: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/DefaultClosureMonitor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/DefaultClosureMonitor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/DefaultClosureMonitor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/DefaultClosureMonitor.java Mon Dec 17 11:13:19 2012
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.shared.ldap.model.cursor;
 
+import java.nio.channels.ClosedChannelException;
+
 
 /**
  * A basic ClosureMonitor that simply uses a boolean for state and a cause
@@ -115,12 +117,12 @@ public class DefaultClosureMonitor imple
     /**
      * {@inheritDoc}
      */
-    public void checkNotClosed() throws Exception
+    public void checkNotClosed() throws CursorClosedException
     {
         // lack of synchronization may cause pass but eventually it will work
         if ( closed )
         {
-            throw cause;
+            throw new CursorClosedException( cause.getMessage() );
         }
     }
 }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EmptyCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EmptyCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EmptyCursor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EmptyCursor.java Mon Dec 17 11:13:19 2012
@@ -19,6 +19,8 @@
 package org.apache.directory.shared.ldap.model.cursor;
 
 
+import java.io.IOException;
+
 import org.apache.directory.shared.i18n.I18n;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -134,7 +136,7 @@ public class EmptyCursor<E> extends Abst
     /**
      * {@inheritDoc}
      */
-    public E get() throws Exception
+    public E get() throws CursorException, IOException
     {
         checkNotClosed( "get()" );
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_02004_EMPTY_CURSOR ) );
@@ -145,7 +147,7 @@ public class EmptyCursor<E> extends Abst
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -160,7 +162,7 @@ public class EmptyCursor<E> extends Abst
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/InconsistentCursorStateException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/InconsistentCursorStateException.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/InconsistentCursorStateException.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/InconsistentCursorStateException.java Mon Dec 17 11:13:19 2012
@@ -26,7 +26,7 @@ package org.apache.directory.shared.ldap
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class InconsistentCursorStateException extends Exception
+public class InconsistentCursorStateException extends CursorException
 {
     /** The serialVersion UID */
     private static final long serialVersionUID = 6222645005251534704L;

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/InvalidCursorPositionException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/InvalidCursorPositionException.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/InvalidCursorPositionException.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/InvalidCursorPositionException.java Mon Dec 17 11:13:19 2012
@@ -25,7 +25,7 @@ package org.apache.directory.shared.ldap
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class InvalidCursorPositionException extends Exception
+public class InvalidCursorPositionException extends CursorException
 {
     /** The serialVersion UID */
     private static final long serialVersionUID = 5730037129071653272L;

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ListCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ListCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ListCursor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/ListCursor.java Mon Dec 17 11:13:19 2012
@@ -491,7 +491,7 @@ public class ListCursor<E> extends Abstr
     /**
      * {@inheritDoc}
      */
-    public E get() throws Exception
+    public E get() throws CursorException, IOException
     {
         checkNotClosed( "get()" );
 
@@ -508,7 +508,7 @@ public class ListCursor<E> extends Abstr
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -523,7 +523,7 @@ public class ListCursor<E> extends Abstr
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java Mon Dec 17 11:13:19 2012
@@ -376,7 +376,7 @@ public class SetCursor<E> extends Abstra
     /**
      * {@inheritDoc}
      */
-    public E get() throws Exception
+    public E get() throws CursorException, IOException
     {
         checkNotClosed( "get()" );
 
@@ -393,7 +393,7 @@ public class SetCursor<E> extends Abstra
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -408,7 +408,7 @@ public class SetCursor<E> extends Abstra
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SingletonCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SingletonCursor.java?rev=1422849&r1=1422848&r2=1422849&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SingletonCursor.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SingletonCursor.java Mon Dec 17 11:13:19 2012
@@ -19,6 +19,7 @@
 package org.apache.directory.shared.ldap.model.cursor;
 
 
+import java.io.IOException;
 import java.util.Comparator;
 
 import org.apache.directory.shared.i18n.I18n;
@@ -308,7 +309,7 @@ public class SingletonCursor<E> extends 
     /**
      * {@inheritDoc}
      */
-    public E get() throws Exception
+    public E get() throws CursorException, IOException
     {
         checkNotClosed( "get" );
 
@@ -332,7 +333,7 @@ public class SingletonCursor<E> extends 
      * {@inheritDoc}
      */
     @Override
-    public void close() throws Exception
+    public void close()
     {
         if ( IS_DEBUG )
         {
@@ -347,7 +348,7 @@ public class SingletonCursor<E> extends 
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause ) throws Exception
+    public void close( Exception cause )
     {
         if ( IS_DEBUG )
         {



Mime
View raw message