directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1728323 - in /directory/shared/trunk/ldap: client/api/src/main/java/org/apache/directory/ldap/client/api/ model/src/main/java/org/apache/directory/api/ldap/model/cursor/
Date Wed, 03 Feb 2016 14:26:34 GMT
Author: elecharny
Date: Wed Feb  3 14:26:34 2016
New Revision: 1728323

URL: http://svn.apache.org/viewvc?rev=1728323&view=rev
Log:
o Changed the Cursor interface so that it extends Closeable
o the close() method now throws an IOException
o Propagated the change in the LDAP API

Modified:
    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/SearchCursorImpl.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/AbstractCursor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/Cursor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/EmptyCursor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/ListCursor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SetCursor.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SingletonCursor.java

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=1728323&r1=1728322&r2=1728323&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
Wed Feb  3 14:26:34 2016
@@ -21,6 +21,8 @@
 package org.apache.directory.ldap.client.api;
 
 
+import java.io.IOException;
+
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.constants.Loggers;
 import org.apache.directory.api.ldap.model.cursor.AbstractCursor;
@@ -94,7 +96,6 @@ public class EntryCursorImpl extends Abs
 
         try
         {
-
             do
             {
                 response = searchCursor.get();
@@ -126,7 +127,14 @@ public class EntryCursorImpl extends Abs
             ldapException.initCause( e );
 
             // close the cursor
-            close( ldapException );
+            try
+            {
+                close( ldapException );
+            }
+            catch ( IOException ioe )
+            {
+                throw new LdapException( ioe.getMessage(), ioe );
+            }
 
             throw ldapException;
         }
@@ -194,7 +202,7 @@ public class EntryCursorImpl extends Abs
      * {@inheritDoc}
      */
     @Override
-    public void close()
+    public void close() throws IOException
     {
         if ( IS_DEBUG )
         {
@@ -209,7 +217,7 @@ public class EntryCursorImpl extends Abs
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause )
+    public void close( Exception cause ) throws IOException
     {
         if ( IS_DEBUG )
         {

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=1728323&r1=1728322&r2=1728323&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
Wed Feb  3 14:26:34 2016
@@ -21,6 +21,7 @@
 package org.apache.directory.ldap.client.api;
 
 
+import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.directory.api.i18n.I18n;
@@ -129,7 +130,14 @@ public class SearchCursorImpl extends Ab
             }
 
             // close the cursor
-            close( ldapException );
+            try 
+            {
+                close( ldapException );
+            }
+            catch ( IOException ioe )
+            {
+                throw new LdapException( ioe.getMessage(), ioe );
+            }
 
             throw ldapException;
         }
@@ -193,7 +201,7 @@ public class SearchCursorImpl extends Ab
      * {@inheritDoc}
      */
     @Override
-    public void close()
+    public void close() throws IOException
     {
         if ( IS_DEBUG )
         {
@@ -208,7 +216,7 @@ public class SearchCursorImpl extends Ab
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause )
+    public void close( Exception cause ) throws IOException
     {
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/AbstractCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/AbstractCursor.java?rev=1728323&r1=1728322&r2=1728323&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/AbstractCursor.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/AbstractCursor.java
Wed Feb  3 14:26:34 2016
@@ -19,6 +19,7 @@
 package org.apache.directory.api.ldap.model.cursor;
 
 
+import java.io.IOException;
 import java.util.Iterator;
 
 import org.apache.directory.api.i18n.I18n;
@@ -74,7 +75,7 @@ public abstract class AbstractCursor<E>
     /**
      * {@inheritDoc}
      */
-    public void close( Exception cause )
+    public void close( Exception cause ) throws IOException
     {
         monitor.close( cause );
     }
@@ -83,7 +84,7 @@ public abstract class AbstractCursor<E>
     /**
      * {@inheritDoc}
      */
-    public void close()
+    public void close() throws IOException
     {
         monitor.close();
     }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/Cursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/Cursor.java?rev=1728323&r1=1728322&r2=1728323&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/Cursor.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/Cursor.java
Wed Feb  3 14:26:34 2016
@@ -19,6 +19,9 @@
 package org.apache.directory.api.ldap.model.cursor;
 
 
+import java.io.Closeable;
+import java.io.IOException;
+
 import org.apache.directory.api.ldap.model.exception.LdapException;
 
 
@@ -40,7 +43,7 @@ import org.apache.directory.api.ldap.mod
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @param <E> The type of element on which this cursor will iterate
  */
-public interface Cursor<E> extends Iterable<E>
+public interface Cursor<E> extends Iterable<E>, Closeable
 {
     /**
      * Determines whether or not a call to get() will succeed.
@@ -223,21 +226,13 @@ public interface Cursor<E> extends Itera
     /**
      * 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.
-     */
-    void close();
-
-
-    /**
-     * 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
      */
-    void close( Exception reason );
+    void close( Exception reason ) throws IOException;
 
 
     /**

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/EmptyCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/EmptyCursor.java?rev=1728323&r1=1728322&r2=1728323&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/EmptyCursor.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/EmptyCursor.java
Wed Feb  3 14:26:34 2016
@@ -19,6 +19,8 @@
 package org.apache.directory.api.ldap.model.cursor;
 
 
+import java.io.IOException;
+
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.constants.Loggers;
 import org.apache.directory.api.ldap.model.exception.LdapException;
@@ -149,7 +151,7 @@ public class EmptyCursor<E> extends Abst
      * {@inheritDoc}
      */
     @Override
-    public void close()
+    public void close() throws IOException
     {
         if ( IS_DEBUG )
         {
@@ -164,7 +166,7 @@ public class EmptyCursor<E> extends Abst
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause )
+    public void close( Exception cause ) throws IOException
     {
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/ListCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/ListCursor.java?rev=1728323&r1=1728322&r2=1728323&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/ListCursor.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/ListCursor.java
Wed Feb  3 14:26:34 2016
@@ -19,6 +19,7 @@
 package org.apache.directory.api.ldap.model.cursor;
 
 
+import java.io.IOException;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -503,7 +504,7 @@ public class ListCursor<E> extends Abstr
      * {@inheritDoc}
      */
     @Override
-    public void close()
+    public void close() throws IOException
     {
         if ( IS_DEBUG )
         {
@@ -518,7 +519,7 @@ public class ListCursor<E> extends Abstr
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause )
+    public void close( Exception cause ) throws IOException
     {
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SetCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SetCursor.java?rev=1728323&r1=1728322&r2=1728323&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SetCursor.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SetCursor.java
Wed Feb  3 14:26:34 2016
@@ -19,6 +19,7 @@
 package org.apache.directory.api.ldap.model.cursor;
 
 
+import java.io.IOException;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Set;
@@ -393,7 +394,7 @@ public class SetCursor<E> extends Abstra
      * {@inheritDoc}
      */
     @Override
-    public void close()
+    public void close() throws IOException
     {
         if ( IS_DEBUG )
         {
@@ -408,7 +409,7 @@ public class SetCursor<E> extends Abstra
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause )
+    public void close( Exception cause ) throws IOException
     {
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SingletonCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SingletonCursor.java?rev=1728323&r1=1728322&r2=1728323&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SingletonCursor.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SingletonCursor.java
Wed Feb  3 14:26:34 2016
@@ -19,6 +19,7 @@
 package org.apache.directory.api.ldap.model.cursor;
 
 
+import java.io.IOException;
 import java.util.Comparator;
 
 import org.apache.directory.api.i18n.I18n;
@@ -326,7 +327,7 @@ public class SingletonCursor<E> extends
      * {@inheritDoc}
      */
     @Override
-    public void close()
+    public void close() throws IOException
     {
         if ( IS_DEBUG )
         {
@@ -341,7 +342,7 @@ public class SingletonCursor<E> extends
      * {@inheritDoc}
      */
     @Override
-    public void close( Exception cause )
+    public void close( Exception cause ) throws IOException
     {
         if ( IS_DEBUG )
         {



Mime
View raw message