directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r687199 - in /directory/apacheds/trunk: btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ btree-base/src/main/java/org/apache/directory/server/xdbm/ core-cursor/src/main/java/org/apache/directory/server/core/cu...
Date Tue, 19 Aug 2008 23:50:45 GMT
Author: akarasulu
Date: Tue Aug 19 16:50:44 2008
New Revision: 687199

URL: http://svn.apache.org/viewvc?rev=687199&view=rev
Log:
changes to cursors:

 o added close() overload where an exception can be provided as an argument in
   case the closing thread is not the user thread and some information about why
   the cursor was closed needs to be communicated to the user thread
 o added implementations of close() overload to abstract classes and other 
   implementations
 o added guards to make sure closed cursors cannot be used for gets and advances
   which is naturally a good thing to do
 o cleaned up the code a bit wrt unused imports and generics complaints


Modified:
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/AbstractTupleCursor.java
    directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java
    directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/Cursor.java
    directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java
    directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleAvlCursor.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
    directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java (original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java Tue Aug 19 16:50:44 2008
@@ -36,6 +36,7 @@
  */
 public class IndexCursorAdaptor<K,O> implements IndexCursor<K,O>
 {
+    @SuppressWarnings("unchecked")
     final Cursor<Tuple> wrappedCursor;
     final ForwardIndexEntry<K, O> forwardEntry;
     final ReverseIndexEntry<K, O> reverseEntry;
@@ -49,6 +50,7 @@
      * @param forwardIndex true for a cursor over a forward index, false for
      * one over a reverse index
      */
+    @SuppressWarnings("unchecked")
     public IndexCursorAdaptor( Cursor<Tuple> wrappedCursor, boolean forwardIndex )
     {
         this.wrappedCursor = wrappedCursor;
@@ -71,6 +73,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void beforeValue( Long id, K key ) throws Exception
     {
         if ( wrappedCursor instanceof TupleCursor )
@@ -80,6 +83,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void afterValue( Long id, K key ) throws Exception
     {
         if ( wrappedCursor instanceof TupleCursor )
@@ -143,18 +147,17 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public IndexEntry<K, O> get() throws Exception
     {
         if ( forwardEntry != null )
         {
-            //noinspection unchecked
             Tuple<K,Long> tuple = wrappedCursor.get();
             forwardEntry.setTuple( tuple, null );
             return forwardEntry;
         }
         else
         {
-            //noinspection unchecked
             Tuple<Long,K> tuple = wrappedCursor.get();
             reverseEntry.setTuple( tuple, null );
             return reverseEntry;
@@ -174,6 +177,12 @@
     }
 
 
+    public void close( Exception reason ) throws Exception
+    {
+        wrappedCursor.close( reason );
+    }
+
+
     public Iterator<IndexEntry<K, O>> iterator()
     {
         return new CursorIterator<IndexEntry<K,O>>( this );

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java (original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java Tue Aug 19 16:50:44 2008
@@ -113,26 +113,6 @@
     }
 
 
-    public boolean relative( int relativePosition ) throws Exception
-    {
-        checkClosed( "relative()" );
-        if ( ( relativePosition + pos ) >= values.size() )
-        {
-            pos = values.size();
-            return false;
-        }
-
-        if ( ( relativePosition + pos ) < 0 )
-        {
-            pos = BEFORE_FIRST;
-            return false;
-        }
-
-        pos += relativePosition;
-        return true;
-    }
-
-
     public boolean first() throws Exception
     {
         checkClosed( "first()" );

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java (original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java Tue Aug 19 16:50:44 2008
@@ -35,12 +35,18 @@
 public abstract class AbstractIndexCursor<K, E> implements IndexCursor<K, E>
 {
     private boolean closed;
+    private Exception reason;
+    
 
-
-    protected void checkClosed( String operation ) throws CursorClosedException
+    protected void checkClosed( String operation ) throws Exception
     {
         if ( isClosed() )
         {
+            if ( reason != null )
+            {
+                throw reason;
+            }
+            
             throw new CursorClosedException( "Attempting " + operation + " operation on a closed Cursor." );
         }
     }
@@ -58,6 +64,13 @@
     }
 
 
+    public void close( Exception reason ) throws Exception
+    {
+        this.reason = reason;
+        closed = true;
+    }
+
+
     public Iterator<IndexEntry<K, E>> iterator()
     {
         return new CursorIterator<IndexEntry<K, E>>( this );

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/AbstractTupleCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/AbstractTupleCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/AbstractTupleCursor.java (original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/xdbm/AbstractTupleCursor.java Tue Aug 19 16:50:44 2008
@@ -35,12 +35,17 @@
 public abstract class AbstractTupleCursor<K,V> implements TupleCursor<K,V>
 {
     private boolean closed;
+    private Exception reason;
 
 
-    protected void checkClosed( String operation ) throws CursorClosedException
+    protected void checkClosed( String operation ) throws Exception
     {
         if ( isClosed() )
         {
+            if ( reason != null )
+            {
+                throw reason;
+            }
             throw new CursorClosedException( "Attempting " + operation + " operation on a closed Cursor." );
         }
     }
@@ -58,6 +63,13 @@
     }
 
 
+    public void close( Exception reason ) throws Exception
+    {
+        this.reason = reason;
+        closed = true;
+    }
+
+
     public Iterator<Tuple<K,V>> iterator()
     {
         return new CursorIterator<Tuple<K,V>>( this );

Modified: directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java (original)
+++ directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java Tue Aug 19 16:50:44 2008
@@ -31,12 +31,18 @@
 public abstract class AbstractCursor<E> implements Cursor<E>
 {
     private boolean closed;
+    private Exception reason;
 
 
-    protected void checkClosed( String operation ) throws CursorClosedException
+    protected void checkClosed( String operation ) throws Exception
     {
         if ( isClosed() )
         {
+            if ( reason != null )
+            {
+                throw reason;
+            }
+            
             throw new CursorClosedException( "Attempting " + operation + " operation on a closed Cursor." );
         }
     }
@@ -48,6 +54,13 @@
     }
 
 
+    public void close( Exception reason ) throws Exception
+    {
+        this.reason = reason;
+        closed = true;
+    }
+
+
     public void close() throws Exception
     {
         closed = true;

Modified: directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/Cursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/Cursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/Cursor.java (original)
+++ directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/Cursor.java Tue Aug 19 16:50:44 2008
@@ -46,7 +46,6 @@
      */
     boolean available();
 
-
     /**
      * Prepares this Cursor, so a subsequent call to Cursor#next() with a
      * true return value, will have positioned the Cursor on a dataset 
@@ -202,4 +201,17 @@
      * @throws Exception if for some reason this Cursor could not be closed
      */
     void close() throws Exception;
+
+
+    /**
+     * 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.  The reason argument is 
+     * the Exception instance thrown instead of the standard 
+     * 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;
 }

Modified: directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java (original)
+++ directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java Tue Aug 19 16:50:44 2008
@@ -32,52 +32,52 @@
         return false;
     }
 
-    public void before( E element ) throws CursorClosedException
+    public void before( E element ) throws Exception
     {
         checkClosed( "before()" );
     }
 
 
-    public void after( E element ) throws CursorClosedException
+    public void after( E element ) throws Exception
     {
         checkClosed( "after()" );
     }
 
 
-    public void beforeFirst() throws CursorClosedException
+    public void beforeFirst() throws Exception
     {
         checkClosed( "beforeFirst()" );
     }
 
 
-    public void afterLast() throws CursorClosedException
+    public void afterLast() throws Exception
     {
         checkClosed( "afterLast()" );
     }
 
 
-    public boolean first() throws CursorClosedException
+    public boolean first() throws Exception
     {
         checkClosed( "first()" );
         return false;
     }
 
 
-    public boolean last() throws CursorClosedException
+    public boolean last() throws Exception
     {
         checkClosed( "last()" );
         return false;
     }
 
 
-    public boolean previous() throws CursorClosedException
+    public boolean previous() throws Exception
     {
         checkClosed( "previous()" );
         return false;
     }
 
 
-    public boolean next() throws CursorClosedException
+    public boolean next() throws Exception
     {
         checkClosed( "next()" );
         return false;

Modified: directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java (original)
+++ directory/apacheds/trunk/core-cursor/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java Tue Aug 19 16:50:44 2008
@@ -88,7 +88,7 @@
     }
 
 
-    public boolean next() throws CursorClosedException
+    public boolean next() throws Exception
     {
         checkClosed( "next()" );
         if ( values.hasNext() )
@@ -101,7 +101,7 @@
     }
 
 
-    public E get() throws CursorClosedException
+    public E get() throws Exception
     {
         checkClosed( "get()" );
         return current;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java Tue Aug 19 16:50:44 2008
@@ -26,6 +26,7 @@
 import java.util.List;
 
 import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.cursor.CursorClosedException;
 import org.apache.directory.server.core.cursor.CursorIterator;
 import org.apache.directory.server.core.cursor.InvalidCursorPositionException;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
@@ -65,6 +66,8 @@
     
     /** the first accepted search result that is pre fetched */
     private ClonedServerEntry prefetched;
+    
+    private Exception reason;
 
     
     // ------------------------------------------------------------------------
@@ -188,6 +191,20 @@
     }
 
     
+    protected void checkClosed( String operation ) throws Exception
+    {
+        if ( isClosed() )
+        {
+            if ( reason != null )
+            {
+                throw reason;
+            }
+            
+            throw new CursorClosedException( "Attempting " + operation + " operation on a closed Cursor." );
+        }
+    }
+
+
     // ------------------------------------------------------------------------
     // Cursor Interface Methods
     // ------------------------------------------------------------------------
@@ -213,6 +230,7 @@
      */
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         wrapped.afterLast();
         prefetched = null;
     }
@@ -250,6 +268,7 @@
      */
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         wrapped.beforeFirst();
         prefetched = null;
     }
@@ -269,6 +288,20 @@
 
 
     /* 
+     * @see Cursor#close()
+     */
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.filtering.EntryFilteringCursor#close()
+     */
+    public void close( Exception reason ) throws Exception
+    {
+        this.reason = reason;
+        wrapped.close( reason );
+        prefetched = null;
+    }
+
+
+    /* 
      * @see Cursor#first()
      */
     /* (non-Javadoc)
@@ -296,6 +329,7 @@
      */
     public ClonedServerEntry get() throws Exception
     {
+        checkClosed( "get()" );
         if ( available() )
         {
             return prefetched;
@@ -474,9 +508,11 @@
             throw new OperationAbandonedException();
         }
         
+        checkClosed( "next()" );
         ClonedServerEntry tempResult = null;
         outer: while ( wrapped.next() )
         {
+            checkClosed( "next()" );
             boolean accepted = true;
             
             ServerEntry tempEntry = wrapped.get();
@@ -518,6 +554,8 @@
             
             for ( EntryFilter filter : filters )
             {
+                checkClosed( "next()" );
+
                 // if a filter rejects then short and continue with outer loop
                 if ( ! ( accepted &= filter.accept( getOperationContext(), tempResult ) ) )
                 {
@@ -553,9 +591,11 @@
             throw new OperationAbandonedException();
         }
         
+        checkClosed( "previous()" );
         ClonedServerEntry tempResult = null;
         outer: while ( wrapped.previous() )
         {
+            checkClosed( "previous()" );
             boolean accepted = true;
             tempResult = new ClonedServerEntry( wrapped.get() );
             
@@ -588,6 +628,7 @@
             
             for ( EntryFilter filter : filters )
             {
+                checkClosed( "previous()" );
                 // if a filter rejects then short and continue with outer loop
                 if ( ! ( accepted &= filter.accept( getOperationContext(), tempResult ) ) )
                 {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java Tue Aug 19 16:50:44 2008
@@ -104,6 +104,15 @@
 
 
     /* 
+     * @see Cursor#close()
+     */
+    public void close( Exception e ) throws Exception
+    {
+        indexCursor.close( e );
+    }
+
+
+    /* 
      * @see Cursor#first()
      */
     public boolean first() throws Exception

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Tue Aug 19 16:50:44 2008
@@ -1053,5 +1053,12 @@
         {
             return new CursorIterator<ServerEntry>( this );
         }
+
+
+        public void close( Exception reason ) throws Exception
+        {
+            // TODO Auto-generated method stub
+            
+        }
     }
 }

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java Tue Aug 19 16:50:44 2008
@@ -82,12 +82,14 @@
 
     public void beforeKey( K key ) throws Exception
     {
+        checkClosed( "beforeKey()" );
         browser = table.getBTree().browse( key );
         forwardDirection = null;
         clearValue();
     }
 
 
+    @SuppressWarnings("unchecked")
     public void afterKey( K key ) throws Exception
     {
         browser = table.getBTree().browse( key );
@@ -102,7 +104,7 @@
          */
         while ( browser.getNext( jdbmTuple ) )
         {
-            //noinspection unchecked
+            checkClosed( "afterKey()" );
             K next = ( K ) jdbmTuple.getKey();
 
             int nextCompared = table.getKeyComparator().compare( next, key );
@@ -125,14 +127,12 @@
     }
 
 
-    @SuppressWarnings( { "UnusedDeclaration" } )
     public void beforeValue( K key, DupsContainer<V> value ) throws Exception
     {
         throw new UnsupportedOperationException( "Value based advances not supported." );
     }
 
 
-    @SuppressWarnings( { "UnusedDeclaration" } )
     public void afterValue( K key, DupsContainer<V> value ) throws Exception
     {
         throw new UnsupportedOperationException( "Value based advances not supported." );
@@ -157,38 +157,42 @@
     }
 
 
-    public void beforeFirst() throws IOException
+    public void beforeFirst() throws Exception
     {
+        checkClosed( "afterKey()" );
         browser = table.getBTree().browse();
         forwardDirection = null;
         clearValue();
     }
 
 
-    public void afterLast() throws IOException
+    public void afterLast() throws Exception
     {
+        checkClosed( "afterKey()" );
         browser = table.getBTree().browse( null );
         forwardDirection = null;
         clearValue();
     }
 
 
-    public boolean first() throws IOException
+    public boolean first() throws Exception
     {
         beforeFirst();
         return next();
     }
 
 
-    public boolean last() throws IOException
+    public boolean last() throws Exception
     {
         afterLast();
         return previous();
     }
 
 
-    public boolean previous() throws IOException
+    @SuppressWarnings("unchecked")
+    public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         if ( browser == null )
         {
             afterLast();
@@ -211,7 +215,6 @@
 
         if ( advanceSuccess )
         {
-            //noinspection unchecked
             returnedTuple.setKey( ( K ) jdbmTuple.getKey() );
             returnedTuple.setValue( table.getDupsContainer( ( byte[] ) jdbmTuple.getValue() ) );
             return valueAvailable = true;
@@ -224,8 +227,10 @@
     }
 
 
-    public boolean next() throws IOException
+    @SuppressWarnings("unchecked")
+    public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         if ( browser == null )
         {
             beforeFirst();
@@ -248,7 +253,6 @@
 
         if ( advanceSuccess )
         {
-            //noinspection unchecked
             returnedTuple.setKey( ( K ) jdbmTuple.getKey() );
             returnedTuple.setValue( table.getDupsContainer( ( byte[] ) jdbmTuple.getValue() ) );
             return valueAvailable = true;
@@ -263,6 +267,7 @@
 
     public Tuple<K,DupsContainer<V>> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( valueAvailable )
         {
             return returnedTuple;

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java Tue Aug 19 16:50:44 2008
@@ -85,6 +85,7 @@
 
     public void beforeValue( K key, V value ) throws Exception
     {
+        checkClosed( "beforeValue()" );
         containerCursor.before( new Tuple<K,DupsContainer<V>>( key, null ) );
 
         if ( containerCursor.next() )
@@ -131,6 +132,7 @@
 
     public void afterValue( K key, V value ) throws Exception
     {
+        checkClosed( "afterValue()" );
         /*
          * There is a subtle difference between after and before handling
          * with dupicate key values.  Say we have the following tuples:
@@ -211,6 +213,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         clearValue();
         containerCursor.beforeFirst();
         containerTuple.setKey( null );
@@ -221,6 +224,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         clearValue();
         containerCursor.afterLast();
         containerTuple.setKey( null );
@@ -231,6 +235,7 @@
 
     public boolean first() throws Exception
     {
+        checkClosed( "first()" );
         clearValue();
         dupsCursor = null;
 
@@ -267,6 +272,7 @@
 
     public boolean last() throws Exception
     {
+        checkClosed( "last()" );
         clearValue();
         dupsCursor = null;
 
@@ -313,6 +319,7 @@
 
     public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         /*
          * If the iterator over the values of the current key is null or is
          * extinguished then we need to advance to the previous key.
@@ -364,6 +371,7 @@
 
     public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         /*
          * If the iterator over the values of the current key is null or is
          * extinguished then we need to advance to the next key.

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java Tue Aug 19 16:50:44 2008
@@ -76,6 +76,7 @@
 
     public void before( E element ) throws Exception
     {
+        checkClosed( "before()" );
         browser = btree.browse( element );
         clearValue();
     }
@@ -94,6 +95,7 @@
          */
         while ( browser.getNext( tuple ) )
         {
+            checkClosed( "after()" );
             //noinspection unchecked
             E next = ( E ) tuple.getKey();
             int nextCompared = comparator.compare( next, element );
@@ -123,6 +125,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         browser = btree.browse();
         clearValue();
     }
@@ -130,6 +133,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         browser = btree.browse( null );
     }
 
@@ -150,6 +154,7 @@
 
     public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         if ( browser == null )
         {
             browser = btree.browse( null );
@@ -169,6 +174,7 @@
 
     public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         if ( browser == null )
         {
             browser = btree.browse();
@@ -188,6 +194,7 @@
 
     public E get() throws Exception
     {
+        checkClosed( "get()" );
         if ( valueAvailable )
         {
             //noinspection unchecked

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleAvlCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleAvlCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleAvlCursor.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleAvlCursor.java Tue Aug 19 16:50:44 2008
@@ -84,6 +84,7 @@
 
     public void beforeValue( K key, V value ) throws Exception
     {
+        checkClosed( "beforeValue()" );
         if ( key != null && ! key.equals( this.key ) )
         {
             throw new UnsupportedOperationException( "This cursor locks down the key so keywise advances are not allowed." );
@@ -96,6 +97,7 @@
 
     public void afterValue( K key, V value ) throws Exception
     {
+        checkClosed( "afterValue()" );
         if ( key != null && ! key.equals( this.key ) )
         {
             throw new UnsupportedOperationException( "This cursor locks down the key so keywise advances are not allowed." );
@@ -116,6 +118,7 @@
      */
     public void before( Tuple<K,V> element ) throws Exception
     {
+        checkClosed( "before()" );
         wrapped.before( element.getValue() );
         clearValue();
     }
@@ -123,6 +126,7 @@
 
     public void after( Tuple<K,V> element ) throws Exception
     {
+        checkClosed( "after()" );
         wrapped.after( element.getValue() );
         clearValue();
     }
@@ -130,6 +134,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         wrapped.beforeFirst();
         clearValue();
     }
@@ -137,6 +142,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         wrapped.afterLast();
         clearValue();
     }
@@ -158,6 +164,7 @@
 
     public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         if ( wrapped.previous() )
         {
             returnedTuple.setKey( key );
@@ -174,6 +181,7 @@
 
     public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         if ( wrapped.next() )
         {
             returnedTuple.setKey( key );
@@ -190,6 +198,7 @@
 
     public Tuple<K,V> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( valueAvailable )
         {
             return returnedTuple;

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java Tue Aug 19 16:50:44 2008
@@ -94,6 +94,7 @@
 
     public void beforeValue( K key, V value ) throws Exception
     {
+        checkClosed( "beforeValue()" );
         if ( key != null && ! key.equals( this.key ) )
         {
             throw new UnsupportedOperationException( "This cursor locks down the key so keywise advances are not allowed." );
@@ -122,6 +123,8 @@
          */
         while ( browser.getNext( valueTuple ) )
         {
+            checkClosed( "afterValue" );
+
             //noinspection unchecked
             V next = ( V ) valueTuple.getKey();
 
@@ -167,6 +170,7 @@
      */
     public void before( Tuple<K,V> element ) throws Exception
     {
+        checkClosed( "before()" );
         browser = btree.browse( element.getValue() );
         clearValue();
     }
@@ -180,6 +184,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         browser = btree.browse();
         clearValue();
     }
@@ -187,6 +192,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         browser = btree.browse( null );
     }
 
@@ -207,6 +213,7 @@
 
     public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         if ( browser.getPrevious( valueTuple ) )
         {
             // work around to fix direction change problem with jdbm browser
@@ -231,6 +238,7 @@
 
     public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         if ( browser.getNext( valueTuple ) )
         {
             // work around to fix direction change problem with jdbm browser
@@ -255,6 +263,7 @@
 
     public Tuple<K,V> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( valueAvailable )
         {
             //noinspection unchecked

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java Tue Aug 19 16:50:44 2008
@@ -77,11 +77,13 @@
 
     public void beforeKey( K key ) throws Exception
     {
+        checkClosed( "beforeKey()" );
         browser = table.getBTree().browse( key );
         clearValue();
     }
 
 
+    @SuppressWarnings("unchecked")
     public void afterKey( K key ) throws Exception
     {
         browser = table.getBTree().browse( key );
@@ -95,7 +97,7 @@
          */
         while ( browser.getNext( jdbmTuple ) )
         {
-            //noinspection unchecked
+            checkClosed( "afterKey()" );
             K next = ( K ) jdbmTuple.getKey();
 
             int nextCompared = table.getKeyComparator().compare( next, key );
@@ -142,36 +144,40 @@
     }
 
 
-    public void beforeFirst() throws IOException
+    public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         browser = table.getBTree().browse();
         clearValue();
     }
 
 
-    public void afterLast() throws IOException
+    public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         browser = table.getBTree().browse( null );
         clearValue();
     }
 
 
-    public boolean first() throws IOException
+    public boolean first() throws Exception
     {
         beforeFirst();
         return next();
     }
 
 
-    public boolean last() throws IOException
+    public boolean last() throws Exception
     {
         afterLast();
         return previous();
     }
 
 
-    public boolean previous() throws IOException
+    @SuppressWarnings("unchecked")
+    public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         if ( browser == null )
         {
             afterLast();
@@ -188,9 +194,7 @@
                 }
             }
 
-            //noinspection unchecked
             returnedTuple.setKey( ( K ) jdbmTuple.getKey() );
-            //noinspection unchecked
             returnedTuple.setValue( ( V ) jdbmTuple.getValue() );
             return valueAvailable = true;
         }
@@ -202,8 +206,10 @@
     }
 
 
-    public boolean next() throws IOException
+    @SuppressWarnings("unchecked")
+    public boolean next() throws Exception
     {
+        checkClosed( "previous()" );
         if ( browser == null )
         {
             beforeFirst();
@@ -220,9 +226,7 @@
                 }
             }
             
-            //noinspection unchecked
             returnedTuple.setKey( ( K ) jdbmTuple.getKey() );
-            //noinspection unchecked
             returnedTuple.setValue( ( V ) jdbmTuple.getValue() );
             return valueAvailable = true;
         }
@@ -236,6 +240,7 @@
 
     public Tuple<K,V> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( valueAvailable )
         {
             return returnedTuple;

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java Tue Aug 19 16:50:44 2008
@@ -52,6 +52,7 @@
      */
     public void afterValue( Long key, Long value ) throws Exception
     {
+        checkClosed( "afterValue()" );
         wrapped.afterValue( key, null );
     }
 
@@ -61,6 +62,7 @@
      */
     public void beforeValue( Long id, Long value ) throws Exception
     {
+        checkClosed( "beforeValue()" );
         wrapped.beforeValue( id, null );
     }
 
@@ -70,6 +72,7 @@
      */
     public void after( IndexEntry<Long,ServerEntry> indexEntry ) throws Exception
     {
+        checkClosed( "after()" );
         wrapped.afterValue( indexEntry.getId(), null );
     }
 
@@ -79,6 +82,7 @@
      */
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         wrapped.afterLast();
     }
 
@@ -97,6 +101,7 @@
      */
     public void before( IndexEntry<Long,ServerEntry> indexEntry ) throws Exception
     {
+        checkClosed( "before()" );
         wrapped.beforeValue( indexEntry.getId(), null );
     }
 
@@ -106,6 +111,7 @@
      */
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         wrapped.beforeFirst();
     }
 
@@ -115,6 +121,7 @@
      */
     public boolean first() throws Exception
     {
+        checkClosed( "first()" );
         return wrapped.first();
     }
 
@@ -124,6 +131,7 @@
      */
     public IndexEntry<Long,ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         IndexEntry<String,ServerEntry> wrappedEntry = wrapped.get();
         indexEntry.setId( wrappedEntry.getId() );
         indexEntry.setValue( wrappedEntry.getId() );
@@ -146,6 +154,7 @@
      */
     public boolean last() throws Exception
     {
+        checkClosed( "last()" );
         return wrapped.last();
     }
 
@@ -155,6 +164,7 @@
      */
     public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         return wrapped.next();
     }
 
@@ -164,6 +174,7 @@
      */
     public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         return wrapped.previous();
     }
 }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java Tue Aug 19 16:50:44 2008
@@ -86,6 +86,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         wrapped.beforeFirst();
         available = false;
     }
@@ -93,6 +94,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         wrapped.afterLast();
         available = false;
     }
@@ -116,6 +118,8 @@
     {
         while ( wrapped.previous() )
         {
+            checkClosed( "previous()" );
+
             IndexEntry<?,ServerEntry> candidate = wrapped.get();
             if ( matches( candidate ) )
             {
@@ -131,6 +135,7 @@
     {
         while ( wrapped.next() )
         {
+            checkClosed( "next()" );
             IndexEntry<?,ServerEntry> candidate = wrapped.get();
             if ( matches( candidate ) )
             {
@@ -144,6 +149,7 @@
 
     public IndexEntry<V, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( available )
         {
             return wrapped.get();

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java Tue Aug 19 16:50:44 2008
@@ -94,6 +94,7 @@
 
     public void beforeValue( Long id, V value ) throws Exception
     {
+        checkClosed( "beforeValue()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.beforeValue( id, value );
@@ -107,6 +108,7 @@
 
     public void afterValue( Long id, V value ) throws Exception
     {
+        checkClosed( "afterValue()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.afterValue( id, value );
@@ -120,6 +122,7 @@
 
     public void before( IndexEntry<V, ServerEntry> element ) throws Exception
     {
+        checkClosed( "before()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.before( element );
@@ -133,6 +136,7 @@
 
     public void after( IndexEntry<V, ServerEntry> element ) throws Exception
     {
+        checkClosed( "after()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.after( element );
@@ -146,6 +150,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.beforeFirst();
@@ -160,6 +165,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.afterLast();
@@ -195,6 +201,7 @@
 
         while( ndnIdxCursor.previous() )
         {
+            checkClosed( "previous()" );
             IndexEntry<?,ServerEntry> candidate = ndnIdxCursor.get();
             if ( approximateEvaluator.evaluate( candidate ) )
             {
@@ -215,6 +222,7 @@
 
         while( ndnIdxCursor.next() )
         {
+            checkClosed( "next()" );
             IndexEntry<?,ServerEntry> candidate = ndnIdxCursor.get();
             if ( approximateEvaluator.evaluate( candidate ) )
             {
@@ -226,8 +234,10 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public IndexEntry<V, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( userIdxCursor != null )
         {
             return userIdxCursor.get();
@@ -235,7 +245,6 @@
 
         if ( available )
         {
-            //noinspection unchecked
             return ( IndexEntry<V, ServerEntry> ) ndnIdxCursor.get();
         }
 

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java Tue Aug 19 16:50:44 2008
@@ -46,6 +46,7 @@
         "EqualityCursors only support positioning by element when a user index exists on the asserted attribute.";
 
     /** An equality evaluator for candidates */
+    @SuppressWarnings("unchecked")
     private final EqualityEvaluator equalityEvaluator;
 
     /** Cursor over attribute entry matching filter: set when index present */
@@ -58,6 +59,7 @@
     private boolean available = false;
 
 
+    @SuppressWarnings("unchecked")
     public EqualityCursor( Store<ServerEntry> db, EqualityEvaluator equalityEvaluator ) throws Exception
     {
         this.equalityEvaluator = equalityEvaluator;
@@ -66,7 +68,6 @@
         Value<V> value = equalityEvaluator.getExpression().getValue();
         if ( db.hasUserIndexOn( attribute ) )
         {
-            //noinspection unchecked
             Index<V,ServerEntry> userIndex = ( Index<V, ServerEntry> ) db.getUserIndex( attribute ); 
             userIdxCursor = userIndex.forwardCursor( value.get() );
             ndnIdxCursor = null;
@@ -92,6 +93,7 @@
 
     public void beforeValue( Long id, V value ) throws Exception
     {
+        checkClosed( "beforeValue()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.beforeValue( id, value );
@@ -105,6 +107,7 @@
 
     public void before( IndexEntry<V, ServerEntry> element ) throws Exception
     {
+        checkClosed( "before()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.before( element );
@@ -118,6 +121,7 @@
 
     public void afterValue( Long id, V key ) throws Exception
     {
+        checkClosed( "afterValue()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.afterValue( id, key );
@@ -131,6 +135,7 @@
 
     public void after( IndexEntry<V, ServerEntry> element ) throws Exception
     {
+        checkClosed( "after()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.after( element );
@@ -144,6 +149,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.beforeFirst();
@@ -158,6 +164,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.afterLast();
@@ -184,6 +191,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public boolean previous() throws Exception
     {
         if ( userIdxCursor != null )
@@ -193,6 +201,7 @@
 
         while( ndnIdxCursor.previous() )
         {
+            checkClosed( "previous()" );
             IndexEntry<?,ServerEntry> candidate = ndnIdxCursor.get();
             if ( equalityEvaluator.evaluate( candidate ) )
             {
@@ -204,6 +213,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public boolean next() throws Exception
     {
         if ( userIdxCursor != null )
@@ -213,6 +223,7 @@
 
         while( ndnIdxCursor.next() )
         {
+            checkClosed( "next()" );
             IndexEntry<?,ServerEntry> candidate = ndnIdxCursor.get();
             if ( equalityEvaluator.evaluate( candidate ) )
             {
@@ -224,8 +235,10 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public IndexEntry<V, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( userIdxCursor != null )
         {
             return userIdxCursor.get();
@@ -233,7 +246,6 @@
 
         if ( available )
         {
-            //noinspection unchecked
             return ( IndexEntry<V, ServerEntry> )ndnIdxCursor.get();
         }
 

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java Tue Aug 19 16:50:44 2008
@@ -60,6 +60,7 @@
     private boolean available = false;
 
 
+    @SuppressWarnings("unchecked")
     public GreaterEqCursor( Store<ServerEntry> db, GreaterEqEvaluator greaterEqEvaluator ) throws Exception
     {
         this.greaterEqEvaluator = greaterEqEvaluator;
@@ -67,7 +68,6 @@
         String attribute = greaterEqEvaluator.getExpression().getAttribute();
         if ( db.hasUserIndexOn( attribute ) )
         {
-            //noinspection unchecked
             userIdxCursor = ( ( Index<V,ServerEntry> ) db.getUserIndex( attribute ) ).forwardCursor();
             ndnIdxCursor = null;
         }
@@ -85,8 +85,10 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void beforeValue( Long id, V value ) throws Exception
     {
+        checkClosed( "beforeValue()" );
         if ( userIdxCursor != null )
         {
             /*
@@ -97,7 +99,6 @@
              * userIdxCursor before the first element.  Otherwise we let the
              * underlying userIdx Cursor position the element.
              */
-            //noinspection unchecked
             if ( greaterEqEvaluator.getComparator().compare( value,
                  greaterEqEvaluator.getExpression().getValue().get() ) <= 0 )
             {
@@ -115,11 +116,12 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void afterValue( Long id, V value ) throws Exception
     {
+        checkClosed( "afterValue()" );
         if ( userIdxCursor != null )
         {
-            //noinspection unchecked
             int comparedValue = greaterEqEvaluator.getComparator().compare( value,
                  greaterEqEvaluator.getExpression().getValue().get() );
 
@@ -154,8 +156,10 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void before( IndexEntry<V, ServerEntry> element ) throws Exception
     {
+        checkClosed( "before()" );
         if ( userIdxCursor != null )
         {
             /*
@@ -166,7 +170,6 @@
              * userIdxCursor before the first element.  Otherwise we let the
              * underlying userIdx Cursor position the element.
              */
-            //noinspection unchecked
             if ( greaterEqEvaluator.getComparator().compare( element.getValue(),
                  greaterEqEvaluator.getExpression().getValue().get() ) <= 0 )
             {
@@ -184,11 +187,12 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void after( IndexEntry<V, ServerEntry> element ) throws Exception
     {
+        checkClosed( "after()" );
         if ( userIdxCursor != null )
         {
-            //noinspection unchecked
             int comparedValue = greaterEqEvaluator.getComparator().compare( element.getValue(),
                  greaterEqEvaluator.getExpression().getValue().get() );
 
@@ -223,12 +227,13 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         if ( userIdxCursor != null )
         {
             IndexEntry<V,ServerEntry> advanceTo = new ForwardIndexEntry<V,ServerEntry>();
-            //noinspection unchecked
             advanceTo.setValue( ( V ) greaterEqEvaluator.getExpression().getValue().get() );
             userIdxCursor.before( advanceTo );
         }
@@ -244,6 +249,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.afterLast();
@@ -272,8 +278,10 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         if ( userIdxCursor != null )
         {
             /*
@@ -282,8 +290,8 @@
              */
             while ( userIdxCursor.previous() )
             {
+                checkClosed( "previous()" );
                 IndexEntry<?,ServerEntry> candidate = userIdxCursor.get();
-                //noinspection unchecked
                 if ( greaterEqEvaluator.getComparator().compare( candidate.getValue(), greaterEqEvaluator.getExpression().getValue().get() ) >= 0 )
                 {
                     return available = true;
@@ -295,6 +303,7 @@
 
         while( ndnIdxCursor.previous() )
         {
+            checkClosed( "previous()" );
             ndnCandidate = ndnIdxCursor.get();
             if ( greaterEqEvaluator.evaluate( ndnCandidate ) )
             {
@@ -308,6 +317,7 @@
 
     public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         if ( userIdxCursor != null )
         {
             /*
@@ -319,6 +329,7 @@
 
         while( ndnIdxCursor.next() )
         {
+            checkClosed( "next()" );
             ndnCandidate = ndnIdxCursor.get();
             if ( greaterEqEvaluator.evaluate( ndnCandidate ) )
             {
@@ -330,8 +341,10 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public IndexEntry<V, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( userIdxCursor != null )
         {
             if ( available )
@@ -344,7 +357,6 @@
 
         if ( available )
         {
-            //noinspection unchecked
             return ( IndexEntry<V, ServerEntry> ) ndnCandidate;
         }
 

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java Tue Aug 19 16:50:44 2008
@@ -60,6 +60,7 @@
     private boolean available = false;
 
 
+    @SuppressWarnings("unchecked")
     public LessEqCursor( Store<ServerEntry> db, LessEqEvaluator lessEqEvaluator ) throws Exception
     {
         this.lessEqEvaluator = lessEqEvaluator;
@@ -67,13 +68,11 @@
         String attribute = lessEqEvaluator.getExpression().getAttribute();
         if ( db.hasUserIndexOn( attribute ) )
         {
-            //noinspection unchecked
             userIdxCursor = ( ( Index<V,ServerEntry> ) db.getUserIndex( attribute ) ).forwardCursor();
             ndnIdxCursor = null;
         }
         else
         {
-            //noinspection unchecked
             ndnIdxCursor = ( IndexCursor<V,ServerEntry> ) db.getNdnIndex().forwardCursor();
             userIdxCursor = null;
         }
@@ -88,6 +87,7 @@
 
     public void beforeValue( Long id, V value ) throws Exception
     {
+        checkClosed( "beforeValue()" );
         if ( userIdxCursor != null )
         {
             /*
@@ -130,8 +130,10 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void before( IndexEntry<V, ServerEntry> element ) throws Exception
     {
+        checkClosed( "before()" );
         if ( userIdxCursor != null )
         {
             /*
@@ -147,7 +149,6 @@
              * If the element's value is smaller, then we delegate to the
              * before() method of the userIdxCursor.
              */
-            //noinspection unchecked
             int compareValue = lessEqEvaluator.getComparator().compare( element.getValue(),
                  lessEqEvaluator.getExpression().getValue().get() );
 
@@ -174,11 +175,12 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void afterValue( Long id, V value ) throws Exception
     {
+        checkClosed( "afterValue()" );
         if ( userIdxCursor != null )
         {
-            //noinspection unchecked
             int comparedValue = lessEqEvaluator.getComparator().compare( value,
                  lessEqEvaluator.getExpression().getValue().get() );
 
@@ -210,11 +212,12 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public void after( IndexEntry<V, ServerEntry> element ) throws Exception
     {
+        checkClosed( "after()" );
         if ( userIdxCursor != null )
         {
-            //noinspection unchecked
             int comparedValue = lessEqEvaluator.getComparator().compare( element.getValue(),
                  lessEqEvaluator.getExpression().getValue().get() );
 
@@ -248,6 +251,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         if ( userIdxCursor != null )
         {
             userIdxCursor.beforeFirst();
@@ -264,6 +268,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         if ( userIdxCursor != null )
         {
             IndexEntry<V,ServerEntry> advanceTo = new ForwardIndexEntry<V,ServerEntry>();
@@ -297,6 +302,8 @@
 
     public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
+
         if ( userIdxCursor != null )
         {
             /*
@@ -309,6 +316,7 @@
 
         while( ndnIdxCursor.previous() )
         {
+            checkClosed( "previous()" );
             ndnCandidate = ndnIdxCursor.get();
             if ( lessEqEvaluator.evaluate( ndnCandidate ) )
             {
@@ -324,8 +332,10 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         if ( userIdxCursor != null )
         {
             /*
@@ -336,8 +346,8 @@
              */
             while ( userIdxCursor.next() )
             {
+                checkClosed( "next()" );
                 IndexEntry<?,ServerEntry> candidate = userIdxCursor.get();
-                //noinspection unchecked
                 if ( lessEqEvaluator.getComparator().compare( candidate.getValue(),
                      lessEqEvaluator.getExpression().getValue().get() ) <= 0 )
                 {
@@ -350,6 +360,7 @@
 
         while( ndnIdxCursor.next() )
         {
+            checkClosed( "next()" );
             ndnCandidate = ndnIdxCursor.get();
             if ( lessEqEvaluator.evaluate( ndnCandidate ) )
             {
@@ -367,6 +378,7 @@
 
     public IndexEntry<V, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( userIdxCursor != null )
         {
             if ( available )

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java Tue Aug 19 16:50:44 2008
@@ -45,11 +45,11 @@
     private boolean available = false;
 
 
+    @SuppressWarnings("unchecked")
     public NotCursor( Store<ServerEntry> db,
                       Evaluator<? extends ExprNode, ServerEntry> childEvaluator ) throws Exception
     {
         this.childEvaluator = childEvaluator;
-        //noinspection unchecked
         this.ndnCursor = ( IndexCursor<V,ServerEntry> ) db.getNdnIndex().forwardCursor();
     }
 
@@ -86,6 +86,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         ndnCursor.beforeFirst();
         available = false;
     }
@@ -93,6 +94,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         ndnCursor.afterLast();
         available = false;
     }
@@ -116,6 +118,7 @@
     {
         while ( ndnCursor.previous() )
         {
+            checkClosed( "previous()" );
             IndexEntry<?,ServerEntry> candidate = ndnCursor.get();
             if ( ! childEvaluator.evaluate( candidate ) )
             {
@@ -131,6 +134,7 @@
     {
         while ( ndnCursor.next() )
         {
+            checkClosed( "next()" );
             IndexEntry<?,ServerEntry> candidate = ndnCursor.get();
             if ( ! childEvaluator.evaluate( candidate ) )
             {
@@ -144,6 +148,7 @@
 
     public IndexEntry<V, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( available )
         {
             return ndnCursor.get();

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java Tue Aug 19 16:50:44 2008
@@ -46,6 +46,7 @@
     private final Store<ServerEntry> db;
 
     /** A onelevel ScopeNode Evaluator */
+    @SuppressWarnings("unchecked")
     private final OneLevelScopeEvaluator evaluator;
 
     /** A Cursor over the entries in the scope of the search base */
@@ -68,6 +69,7 @@
      * @param evaluator an IndexEntry (candidate) evaluator
      * @throws Exception on db access failures
      */
+    @SuppressWarnings("unchecked")
     public OneLevelScopeCursor( Store<ServerEntry> db, OneLevelScopeEvaluator evaluator ) throws Exception
     {
         this.db = db;
@@ -117,6 +119,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         cursor = scopeCursor;
         cursor.beforeFirst();
         available = false;
@@ -125,6 +128,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         if ( evaluator.isDereferencing() )
         {
             cursor = dereferencedCursor;
@@ -155,6 +159,7 @@
 
     public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         // if the cursor has not been set - position it after last element
         if ( cursor == null )
         {
@@ -173,6 +178,7 @@
                 // advance until nothing is available or until we find a non-alias
                 do
                 {
+                    checkClosed( "previous()" );
                     available = cursor.previous();
 
                     if ( available && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
@@ -205,6 +211,7 @@
             // advance until nothing is available or until we find a non-alias
             do
             {
+                checkClosed( "previous()" );
                 available = cursor.previous();
 
                 if ( available && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
@@ -223,6 +230,7 @@
 
     public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         // if the cursor hasn't been set position it before the first element
         if ( cursor == null )
         {
@@ -238,6 +246,7 @@
             // advance until nothing is available or until we find a non-alias
             do
             {
+                checkClosed( "next()" );
                 available = cursor.next();
 
                 if ( available && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
@@ -282,6 +291,7 @@
 
     public IndexEntry<Long, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( available )
         {
             return cursor.get();

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java Tue Aug 19 16:50:44 2008
@@ -61,7 +61,7 @@
         this.cursors = cursors;
         this.evaluators = evaluators;
         this.blacklists = new ArrayList<Set<Long>>();
-        //noinspection ForLoopReplaceableByForEach
+
         for ( int ii = 0; ii < cursors.size(); ii++ )
         {
             this.blacklists.add( new HashSet<Long>() );
@@ -102,6 +102,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         cursorIndex = 0;
         cursors.get( cursorIndex ).beforeFirst();
         available = false;
@@ -110,6 +111,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         cursorIndex = cursors.size() - 1;
         cursors.get( cursorIndex ).afterLast();
         available = false;
@@ -152,7 +154,6 @@
                 continue;
             }
 
-            //noinspection unchecked
             if ( evaluators.get( ii ).evaluate( indexEntry ) )
             {
                 blacklists.get( ii ).add( indexEntry.getId() );
@@ -165,6 +166,7 @@
     {
         while ( cursors.get( cursorIndex ).previous() )
         {
+            checkClosed( "previous()" );
             IndexEntry<?,ServerEntry> candidate = cursors.get( cursorIndex ).get();
             if ( ! isBlackListed( candidate.getId() ) )
             {
@@ -175,11 +177,13 @@
 
         while ( cursorIndex > 0 )
         {
+            checkClosed( "previous()" );
             cursorIndex--;
             cursors.get( cursorIndex ).afterLast();
 
             while ( cursors.get( cursorIndex ).previous() )
             {
+                checkClosed( "previous()" );
                 IndexEntry<?,ServerEntry> candidate = cursors.get( cursorIndex ).get();
                 if ( ! isBlackListed( candidate.getId() ) )
                 {
@@ -197,6 +201,7 @@
     {
         while ( cursors.get( cursorIndex ).next() )
         {
+            checkClosed( "next()" );
             IndexEntry<?,ServerEntry> candidate = cursors.get( cursorIndex ).get();
             if ( ! isBlackListed( candidate.getId() ) )
             {
@@ -207,11 +212,13 @@
 
         while ( cursorIndex < cursors.size() - 1 )
         {
+            checkClosed( "previous()" );
             cursorIndex++;
             cursors.get( cursorIndex ).beforeFirst();
 
             while ( cursors.get( cursorIndex ).next() )
             {
+                checkClosed( "previous()" );
                 IndexEntry<?,ServerEntry> candidate = cursors.get( cursorIndex ).get();
                 if ( ! isBlackListed( candidate.getId() ) )
                 {
@@ -227,6 +234,7 @@
 
     public IndexEntry<V, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( available )
         {
             return cursors.get( cursorIndex ).get();
@@ -245,7 +253,7 @@
     public void close() throws Exception
     {
         super.close();
-        for ( Cursor cursor : cursors )
+        for ( Cursor<?> cursor : cursors )
         {
             cursor.close();
         }

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java Tue Aug 19 16:50:44 2008
@@ -76,6 +76,7 @@
 
     public void beforeValue( Long id, String value ) throws Exception
     {
+        checkClosed( "beforeValue()" );
         if ( presenceCursor != null )
         {
             presenceCursor.beforeValue( id, value );
@@ -88,6 +89,7 @@
 
     public void before( IndexEntry<String, ServerEntry> element ) throws Exception
     {
+        checkClosed( "before()" );
         if ( presenceCursor != null )
         {
             presenceCursor.before( element );
@@ -100,6 +102,7 @@
 
     public void afterValue( Long id, String value ) throws Exception
     {
+        checkClosed( "afterValue()" );
         if ( presenceCursor != null )
         {
             presenceCursor.afterValue( id, value );
@@ -112,6 +115,7 @@
 
     public void after( IndexEntry<String, ServerEntry> element ) throws Exception
     {
+        checkClosed( "after()" );
         if ( presenceCursor != null )
         {
             presenceCursor.after( element );
@@ -124,6 +128,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         if ( presenceCursor != null )
         {
             presenceCursor.beforeFirst();
@@ -137,6 +142,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         if ( presenceCursor != null )
         {
             presenceCursor.afterLast();
@@ -150,6 +156,7 @@
 
     public boolean first() throws Exception
     {
+        checkClosed( "first()" );
         if ( presenceCursor != null )
         {
             return presenceCursor.first();
@@ -162,6 +169,7 @@
 
     public boolean last() throws Exception
     {
+        checkClosed( "last()" );
         if ( presenceCursor != null )
         {
             return presenceCursor.last();
@@ -174,6 +182,7 @@
 
     public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         if ( presenceCursor != null )
         {
             return presenceCursor.previous();
@@ -181,6 +190,7 @@
 
         while ( ndnCursor.previous() )
         {
+            checkClosed( "previous()" );
             IndexEntry<?,ServerEntry> candidate = ndnCursor.get();
             if ( presenceEvaluator.evaluate( candidate ) )
             {
@@ -194,6 +204,7 @@
 
     public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         if ( presenceCursor != null )
         {
             return presenceCursor.next();
@@ -201,6 +212,7 @@
 
         while ( ndnCursor.next() )
         {
+            checkClosed( "next()" );
             IndexEntry<?,ServerEntry> candidate = ndnCursor.get();
             if ( presenceEvaluator.evaluate( candidate ) )
             {
@@ -214,6 +226,7 @@
 
     public IndexEntry<String, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( presenceCursor != null )
         {
             if ( presenceCursor.available() )

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java Tue Aug 19 16:50:44 2008
@@ -43,6 +43,7 @@
     private boolean available = false;
 
 
+    @SuppressWarnings("unchecked")
     public SubstringCursor( Store<ServerEntry> db,
                             final SubstringEvaluator substringEvaluator ) throws Exception
     {
@@ -51,7 +52,6 @@
 
         if ( hasIndex )
         {
-            //noinspection unchecked
             wrapped = ( ( Index<String,ServerEntry> ) db.getUserIndex( evaluator.getExpression().getAttribute() ) )
                 .forwardCursor();
         }
@@ -105,6 +105,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         if ( evaluator.getExpression().getInitial() != null && hasIndex )
         {
             ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
@@ -131,6 +132,8 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
+
         // to keep the cursor always *after* the last matched tuple
         // This fixes an issue if the last matched tuple is also the last record present in the 
         // index. In this case the wrapped cursor is positioning on the last tuple instead of positioning after that
@@ -170,6 +173,7 @@
     {
         while ( wrapped.previous() )
         {
+            checkClosed( "previous()" );
             IndexEntry<String,ServerEntry> entry = wrapped.get();
             if ( evaluateCandidate( entry ) )
             {
@@ -190,6 +194,7 @@
     {
         while ( wrapped.next() )
         {
+            checkClosed( "next()" );
             IndexEntry<String,ServerEntry> entry = wrapped.get();
             if ( evaluateCandidate( entry ) )
             {
@@ -208,6 +213,7 @@
 
     public IndexEntry<String, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( available )
         {
             return indexEntry;

Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=687199&r1=687198&r2=687199&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java Tue Aug 19 16:50:44 2008
@@ -123,6 +123,7 @@
 
     public void beforeFirst() throws Exception
     {
+        checkClosed( "beforeFirst()" );
         cursor = scopeCursor;
         cursor.beforeFirst();
         available = false;
@@ -131,6 +132,7 @@
 
     public void afterLast() throws Exception
     {
+        checkClosed( "afterLast()" );
         if ( evaluator.isDereferencing() )
         {
             cursor = dereferencedCursor;
@@ -161,6 +163,7 @@
 
     public boolean previous() throws Exception
     {
+        checkClosed( "previous()" );
         // if the cursor has not been set - position it after last element
         if ( cursor == null )
         {
@@ -179,6 +182,7 @@
                 // advance until nothing is available or until we find a non-alias
                 do
                 {
+                    checkClosed( "previous()" );
                     available = cursor.previous();
                     if ( available && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
                     {
@@ -210,6 +214,7 @@
             // advance until nothing is available or until we find a non-alias
             do
             {
+                checkClosed( "previous()" );
                 available = cursor.previous();
 
                 if ( available && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
@@ -228,6 +233,7 @@
 
     public boolean next() throws Exception
     {
+        checkClosed( "next()" );
         // if the cursor hasn't been set position it before the first element
         if ( cursor == null )
         {
@@ -243,6 +249,7 @@
             // advance until nothing is available or until we find a non-alias
             do
             {
+                checkClosed( "next()" );
                 available = cursor.next();
 
                 if ( available && db.getAliasIndex().reverseLookup( cursor.get().getId() ) == null )
@@ -287,6 +294,7 @@
 
     public IndexEntry<Long, ServerEntry> get() throws Exception
     {
+        checkClosed( "get()" );
         if ( available )
         {
             return cursor.get();



Mime
View raw message