You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2018/02/27 03:25:09 UTC

[directory-ldap-api] 01/04: o Used synchronized/wait/notifyAll to manage messages with simgle response o The isDone method is now implemented

This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-ldap-api.git

commit 5bebbd5b2f8ab1ad6c56ba09f60cc9e766725147
Author: Emmanuel Lécharny <el...@symas.com>
AuthorDate: Tue Feb 27 04:16:40 2018 +0100

    o Used synchronized/wait/notifyAll to manage messages with simgle
    response
    o The isDone method is now implemented
---
 .../ldap/client/api/future/AddFuture.java          |   2 +-
 .../ldap/client/api/future/BindFuture.java         |   2 +-
 .../ldap/client/api/future/CompareFuture.java      |   3 +-
 .../ldap/client/api/future/DeleteFuture.java       |   3 +-
 .../ldap/client/api/future/ExtendedFuture.java     |   2 +-
 .../ldap/client/api/future/ModifyDnFuture.java     |   3 +-
 .../ldap/client/api/future/ModifyFuture.java       |   3 +-
 ...onseFuture.java => MultipleResponseFuture.java} |   6 +-
 .../ldap/client/api/future/ResponseFuture.java     | 146 +--------------------
 .../ldap/client/api/future/SearchFuture.java       |   2 +-
 ...sponseFuture.java => UniqueResponseFuture.java} | 110 ++++++++++------
 .../api/ldap/model/cursor/AbstractCursor.java      |   3 +-
 .../api/ldap/model/cursor/EmptyCursor.java         |  18 +--
 .../api/ldap/model/cursor/ListCursor.java          |  18 +--
 .../directory/api/ldap/model/cursor/SetCursor.java |  18 +--
 .../api/ldap/model/cursor/SingletonCursor.java     |  18 +--
 .../apache/directory/api/ldap/model/name/Rdn.java  |   2 -
 .../api/ldap/model/name/DnParserTest.java          |   4 +-
 .../directory/api/ldap/model/name/RdnTest.java     |   9 ++
 19 files changed, 132 insertions(+), 240 deletions(-)

diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/AddFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/AddFuture.java
index 902b20b..2b1d30d 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/AddFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/AddFuture.java
@@ -29,7 +29,7 @@ import org.apache.directory.ldap.client.api.LdapConnection;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AddFuture extends ResponseFuture<AddResponse>
+public class AddFuture extends UniqueResponseFuture<AddResponse>
 {
     /**
      * Creates a new instance of AddFuture.
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/BindFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/BindFuture.java
index bad1213..e3fccfb 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/BindFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/BindFuture.java
@@ -29,7 +29,7 @@ import org.apache.directory.ldap.client.api.LdapConnection;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class BindFuture extends ResponseFuture<BindResponse>
+public class BindFuture extends MultipleResponseFuture<BindResponse>
 {
     /**
      * Creates a new instance of BindFuture.
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/CompareFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/CompareFuture.java
index 9562c8e..6e1fba5 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/CompareFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/CompareFuture.java
@@ -19,7 +19,6 @@
  */
 package org.apache.directory.ldap.client.api.future;
 
-
 import org.apache.directory.api.ldap.model.message.CompareResponse;
 import org.apache.directory.ldap.client.api.LdapConnection;
 
@@ -29,7 +28,7 @@ import org.apache.directory.ldap.client.api.LdapConnection;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CompareFuture extends ResponseFuture<CompareResponse>
+public class CompareFuture extends UniqueResponseFuture<CompareResponse>
 {
     /**
      * Creates a new instance of CompareFuture.
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/DeleteFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/DeleteFuture.java
index 8043dce..4b8ad04 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/DeleteFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/DeleteFuture.java
@@ -19,7 +19,6 @@
  */
 package org.apache.directory.ldap.client.api.future;
 
-
 import org.apache.directory.api.ldap.model.message.DeleteResponse;
 import org.apache.directory.ldap.client.api.LdapConnection;
 
@@ -29,7 +28,7 @@ import org.apache.directory.ldap.client.api.LdapConnection;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class DeleteFuture extends ResponseFuture<DeleteResponse>
+public class DeleteFuture extends UniqueResponseFuture<DeleteResponse>
 {
     /**
      * Creates a new instance of DeleteFuture.
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ExtendedFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ExtendedFuture.java
index 1f57518..0feacee 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ExtendedFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ExtendedFuture.java
@@ -29,7 +29,7 @@ import org.apache.directory.ldap.client.api.LdapConnection;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ExtendedFuture extends ResponseFuture<Response>
+public class ExtendedFuture extends MultipleResponseFuture<Response>
 {
     /**
      * Creates a new instance of ExtendedFuture.
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ModifyDnFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ModifyDnFuture.java
index f301b86..60e6921 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ModifyDnFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ModifyDnFuture.java
@@ -19,7 +19,6 @@
  */
 package org.apache.directory.ldap.client.api.future;
 
-
 import org.apache.directory.api.ldap.model.message.ModifyDnResponse;
 import org.apache.directory.ldap.client.api.LdapConnection;
 
@@ -29,7 +28,7 @@ import org.apache.directory.ldap.client.api.LdapConnection;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ModifyDnFuture extends ResponseFuture<ModifyDnResponse>
+public class ModifyDnFuture extends UniqueResponseFuture<ModifyDnResponse>
 {
     /**
      * Creates a new instance of ModifyDnFuture.
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ModifyFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ModifyFuture.java
index 56a386b..a1dcaf2 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ModifyFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ModifyFuture.java
@@ -19,7 +19,6 @@
  */
 package org.apache.directory.ldap.client.api.future;
 
-
 import org.apache.directory.api.ldap.model.message.ModifyResponse;
 import org.apache.directory.ldap.client.api.LdapConnection;
 
@@ -29,7 +28,7 @@ import org.apache.directory.ldap.client.api.LdapConnection;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ModifyFuture extends ResponseFuture<ModifyResponse>
+public class ModifyFuture extends UniqueResponseFuture<ModifyResponse>
 {
     /**
      * Creates a new instance of ModifyFuture.
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/MultipleResponseFuture.java
similarity index 96%
copy from ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
copy to ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/MultipleResponseFuture.java
index 7cb2931..1d582a8 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/MultipleResponseFuture.java
@@ -17,12 +17,10 @@
  *   under the License.
  *
  */
-
 package org.apache.directory.ldap.client.api.future;
 
 
 import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Future;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
@@ -36,7 +34,7 @@ import org.apache.directory.ldap.client.api.LdapConnection;
  * @param <R> The result type returned by this Future's <tt>get</tt> method
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ResponseFuture<R extends Response> implements Future<Response>
+public abstract class MultipleResponseFuture<R extends Response> implements ResponseFuture<R>
 {
     /** the blocking queue holding LDAP responses */
     protected BlockingQueue<R> queue;
@@ -60,7 +58,7 @@ public class ResponseFuture<R extends Response> implements Future<Response>
      * @param connection The LdapConnection used by the request
      * @param messageId The associated message ID
      */
-    public ResponseFuture( LdapConnection connection, int messageId )
+    public MultipleResponseFuture( LdapConnection connection, int messageId )
     {
         queue = new LinkedBlockingQueue<>();
         this.messageId = messageId;
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
index 7cb2931..2c8b73b 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
@@ -17,17 +17,12 @@
  *   under the License.
  *
  */
-
 package org.apache.directory.ldap.client.api.future;
 
 
-import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.Future;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.directory.api.ldap.model.message.Response;
-import org.apache.directory.ldap.client.api.LdapConnection;
 
 
 /**
@@ -36,164 +31,33 @@ import org.apache.directory.ldap.client.api.LdapConnection;
  * @param <R> The result type returned by this Future's <tt>get</tt> method
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ResponseFuture<R extends Response> implements Future<Response>
+public interface ResponseFuture<R extends Response> extends Future<R>
 {
-    /** the blocking queue holding LDAP responses */
-    protected BlockingQueue<R> queue;
-
-    /** flag to determine if this future is cancelled */
-    protected boolean cancelled = false;
-
-    /** If the request has been cancelled because of an exception  it will be stored here */
-    protected Throwable cause;
-
-    /** The messageID for this future */
-    protected int messageId;
-
-    /** The connection used by the request */
-    protected LdapConnection connection;
-
-
-    /**
-     * Creates a new instance of ResponseFuture.
-     *
-     * @param connection The LdapConnection used by the request
-     * @param messageId The associated message ID
-     */
-    public ResponseFuture( LdapConnection connection, int messageId )
-    {
-        queue = new LinkedBlockingQueue<>();
-        this.messageId = messageId;
-        this.connection = connection;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean cancel( boolean mayInterruptIfRunning )
-    {
-        if ( cancelled )
-        {
-            return cancelled;
-        }
-
-        // set the cancel flag first
-        cancelled = true;
-
-        // Send an abandonRequest only if this future exists
-        if ( !connection.isRequestCompleted( messageId ) )
-        {
-            connection.abandon( messageId );
-        }
-
-        // then clear the queue, cause the might be some incoming messages before this abandon request
-        // hits the server
-        queue.clear();
-
-        return cancelled;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * @throws InterruptedException if the operation has been cancelled by client
-     */
-    @Override
-    public R get() throws InterruptedException
-    {
-        return queue.take();
-    }
-
-
     /**
      * Set the associated Response in this Future
      * 
      * @param response The response to add into the Future
      * @throws InterruptedException if the operation has been cancelled by client
      */
-    public void set( R response ) throws InterruptedException
-    {
-        queue.add( response );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * @throws InterruptedException if the operation has been cancelled by client
-     */
-    @Override
-    public R get( long timeout, TimeUnit unit ) throws InterruptedException
-    {
-        return queue.poll( timeout, unit );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isCancelled()
-    {
-        return cancelled;
-    }
-
-
-    /**
-     * This operation is not supported in this implementation of Future.
-     * 
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isDone()
-    {
-        throw new UnsupportedOperationException( "Operation not supported" );
-    }
+    void set( R response ) throws InterruptedException;
 
 
     /**
      * @return the cause
      */
-    public Throwable getCause()
-    {
-        return cause;
-    }
+    Throwable getCause();
 
 
     /**
      * Associate a cause to the ResponseFuture
      * @param cause the cause to set
      */
-    public void setCause( Throwable cause )
-    {
-        this.cause = cause;
-    }
+    void setCause( Throwable cause );
 
 
     /**
      * Cancel the Future
      *
      */
-    public void cancel()
-    {
-        // set the cancel flag first
-        cancelled = true;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder();
-
-        sb.append( "[msgId : " ).append( messageId ).append( ", " );
-        sb.append( "size : " ).append( queue.size() ).append( ", " );
-        sb.append( "Canceled :" ).append( cancelled ).append( "]" );
-
-        return sb.toString();
-    }
+    void cancel();
 }
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/SearchFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/SearchFuture.java
index c88d56d..b8f1e03 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/SearchFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/SearchFuture.java
@@ -29,7 +29,7 @@ import org.apache.directory.ldap.client.api.LdapConnection;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SearchFuture extends ResponseFuture<Response>
+public class SearchFuture extends MultipleResponseFuture<Response>
 {
     /**
      * Creates a new instance of SearchFuture.
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/UniqueResponseFuture.java
similarity index 75%
copy from ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
copy to ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/UniqueResponseFuture.java
index 7cb2931..8bb9a7d 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/future/UniqueResponseFuture.java
@@ -17,29 +17,29 @@
  *   under the License.
  *
  */
-
 package org.apache.directory.ldap.client.api.future;
 
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Future;
-import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 import org.apache.directory.api.ldap.model.message.Response;
 import org.apache.directory.ldap.client.api.LdapConnection;
 
-
 /**
- * A Future implementation used in LdapConnection operations.
+ * A Future implementation used in LdapConnection operations for operations
+ * that only get one single response.
  *
  * @param <R> The result type returned by this Future's <tt>get</tt> method
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ResponseFuture<R extends Response> implements Future<Response>
+public abstract class UniqueResponseFuture<R extends Response> implements ResponseFuture<R>
 {
-    /** the blocking queue holding LDAP responses */
-    protected BlockingQueue<R> queue;
+    /** A lock for the response */
+    private final Lock lock = new ReentrantLock();
+    
+    /** The response */
+    private R response;
 
     /** flag to determine if this future is cancelled */
     protected boolean cancelled = false;
@@ -53,16 +53,14 @@ public class ResponseFuture<R extends Response> implements Future<Response>
     /** The connection used by the request */
     protected LdapConnection connection;
 
-
     /**
-     * Creates a new instance of ResponseFuture.
+     * Creates a new instance of UniqueResponseFuture.
      *
      * @param connection The LdapConnection used by the request
      * @param messageId The associated message ID
      */
-    public ResponseFuture( LdapConnection connection, int messageId )
+    public UniqueResponseFuture( LdapConnection connection, int messageId )
     {
-        queue = new LinkedBlockingQueue<>();
         this.messageId = messageId;
         this.connection = connection;
     }
@@ -70,29 +68,14 @@ public class ResponseFuture<R extends Response> implements Future<Response>
 
     /**
      * {@inheritDoc}
+     * @throws InterruptedException if the operation has been cancelled by client
      */
     @Override
-    public boolean cancel( boolean mayInterruptIfRunning )
+    public R get() throws InterruptedException
     {
-        if ( cancelled )
-        {
-            return cancelled;
-        }
-
-        // set the cancel flag first
-        cancelled = true;
-
-        // Send an abandonRequest only if this future exists
-        if ( !connection.isRequestCompleted( messageId ) )
-        {
-            connection.abandon( messageId );
-        }
-
-        // then clear the queue, cause the might be some incoming messages before this abandon request
-        // hits the server
-        queue.clear();
-
-        return cancelled;
+        lock.wait();
+        
+        return response;
     }
 
 
@@ -101,9 +84,13 @@ public class ResponseFuture<R extends Response> implements Future<Response>
      * @throws InterruptedException if the operation has been cancelled by client
      */
     @Override
-    public R get() throws InterruptedException
+    public R get( long timeout, TimeUnit unit ) throws InterruptedException
     {
-        return queue.take();
+        long nanos = unit.toNanos( timeout );
+        
+        lock.wait( nanos / 1_000_000, ( int ) nanos );
+        
+        return response;
     }
 
 
@@ -115,18 +102,50 @@ public class ResponseFuture<R extends Response> implements Future<Response>
      */
     public void set( R response ) throws InterruptedException
     {
-        queue.add( response );
+        try 
+        {
+            lock.lock();
+            this.response = response;
+            lock.notify();
+        }
+        finally
+        {
+            lock.unlock();
+        }
     }
 
 
     /**
      * {@inheritDoc}
-     * @throws InterruptedException if the operation has been cancelled by client
      */
     @Override
-    public R get( long timeout, TimeUnit unit ) throws InterruptedException
+    public boolean cancel( boolean mayInterruptIfRunning )
     {
-        return queue.poll( timeout, unit );
+        if ( cancelled )
+        {
+            return cancelled;
+        }
+
+        // set the cancel flag first
+        cancelled = true;
+
+        // Send an abandonRequest only if this future exists
+        if ( !connection.isRequestCompleted( messageId ) )
+        {
+            connection.abandon( messageId );
+        }
+        
+        // Notify the future
+        try
+        { 
+            set( null );
+        }
+        catch ( InterruptedException ie )
+        {
+            // Nothing we can do
+        }
+
+        return cancelled;
     }
 
 
@@ -179,6 +198,16 @@ public class ResponseFuture<R extends Response> implements Future<Response>
     {
         // set the cancel flag first
         cancelled = true;
+        
+        // Notify the future
+        try
+        { 
+            set( null );
+        }
+        catch ( InterruptedException ie )
+        {
+            // Nothing we can do
+        }
     }
 
 
@@ -191,7 +220,6 @@ public class ResponseFuture<R extends Response> implements Future<Response>
         StringBuilder sb = new StringBuilder();
 
         sb.append( "[msgId : " ).append( messageId ).append( ", " );
-        sb.append( "size : " ).append( queue.size() ).append( ", " );
         sb.append( "Canceled :" ).append( cancelled ).append( "]" );
 
         return sb.toString();
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/AbstractCursor.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/AbstractCursor.java
index 36518ec..1a6af60 100755
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/AbstractCursor.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/AbstractCursor.java
@@ -55,10 +55,9 @@ public abstract class AbstractCursor<E> implements Cursor<E>
     /**
      * Check that the cursor is not closed before executing an operation.
      * 
-     * @param operation The operation we try to execute
      * @throws CursorClosedException If there is a problem during the check
      */
-    public final void checkNotClosed( String operation ) throws CursorClosedException
+    public final void checkNotClosed() throws CursorClosedException
     {
         monitor.checkNotClosed();
     }
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/EmptyCursor.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/EmptyCursor.java
index d10217c..5030c02 100755
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/EmptyCursor.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/EmptyCursor.java
@@ -70,7 +70,7 @@ public class EmptyCursor<E> extends AbstractCursor<E>
     @Override
     public void before( E element ) throws LdapException, CursorException
     {
-        checkNotClosed( "before()" );
+        checkNotClosed();
     }
 
 
@@ -80,7 +80,7 @@ public class EmptyCursor<E> extends AbstractCursor<E>
     @Override
     public void after( E element ) throws LdapException, CursorException
     {
-        checkNotClosed( "after()" );
+        checkNotClosed();
     }
 
 
@@ -90,7 +90,7 @@ public class EmptyCursor<E> extends AbstractCursor<E>
     @Override
     public void beforeFirst() throws LdapException, CursorException
     {
-        checkNotClosed( "beforeFirst()" );
+        checkNotClosed();
     }
 
 
@@ -100,7 +100,7 @@ public class EmptyCursor<E> extends AbstractCursor<E>
     @Override
     public void afterLast() throws LdapException, CursorException
     {
-        checkNotClosed( "afterLast()" );
+        checkNotClosed();
     }
 
 
@@ -110,7 +110,7 @@ public class EmptyCursor<E> extends AbstractCursor<E>
     @Override
     public boolean first() throws LdapException, CursorException
     {
-        checkNotClosed( "first()" );
+        checkNotClosed();
         return false;
     }
 
@@ -121,7 +121,7 @@ public class EmptyCursor<E> extends AbstractCursor<E>
     @Override
     public boolean last() throws LdapException, CursorException
     {
-        checkNotClosed( "last()" );
+        checkNotClosed();
         return false;
     }
 
@@ -132,7 +132,7 @@ public class EmptyCursor<E> extends AbstractCursor<E>
     @Override
     public boolean previous() throws LdapException, CursorException
     {
-        checkNotClosed( "previous()" );
+        checkNotClosed();
         return false;
     }
 
@@ -143,7 +143,7 @@ public class EmptyCursor<E> extends AbstractCursor<E>
     @Override
     public boolean next() throws LdapException, CursorException
     {
-        checkNotClosed( "next()" );
+        checkNotClosed();
         return false;
     }
 
@@ -154,7 +154,7 @@ public class EmptyCursor<E> extends AbstractCursor<E>
     @Override
     public E get() throws CursorException
     {
-        checkNotClosed( "get()" );
+        checkNotClosed();
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_02004_EMPTY_CURSOR ) );
     }
 
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/ListCursor.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/ListCursor.java
index a364d65..39bca9e 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/ListCursor.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/ListCursor.java
@@ -251,7 +251,7 @@ public class ListCursor<E> extends AbstractCursor<E>
     @Override
     public void before( E element ) throws LdapException, CursorException
     {
-        checkNotClosed( "before()" );
+        checkNotClosed();
 
         if ( comparator == null )
         {
@@ -285,7 +285,7 @@ public class ListCursor<E> extends AbstractCursor<E>
     @Override
     public void after( E element ) throws LdapException, CursorException
     {
-        checkNotClosed( "after()" );
+        checkNotClosed();
 
         if ( comparator == null )
         {
@@ -319,7 +319,7 @@ public class ListCursor<E> extends AbstractCursor<E>
     @Override
     public void beforeFirst() throws LdapException, CursorException
     {
-        checkNotClosed( "beforeFirst()" );
+        checkNotClosed();
         this.index = -1;
     }
 
@@ -330,7 +330,7 @@ public class ListCursor<E> extends AbstractCursor<E>
     @Override
     public void afterLast() throws LdapException, CursorException
     {
-        checkNotClosed( "afterLast()" );
+        checkNotClosed();
         this.index = end;
     }
 
@@ -341,7 +341,7 @@ public class ListCursor<E> extends AbstractCursor<E>
     @Override
     public boolean first() throws LdapException, CursorException
     {
-        checkNotClosed( "first()" );
+        checkNotClosed();
 
         if ( !list.isEmpty() )
         {
@@ -360,7 +360,7 @@ public class ListCursor<E> extends AbstractCursor<E>
     @Override
     public boolean last() throws LdapException, CursorException
     {
-        checkNotClosed( "last()" );
+        checkNotClosed();
 
         if ( !list.isEmpty() )
         {
@@ -419,7 +419,7 @@ public class ListCursor<E> extends AbstractCursor<E>
     @Override
     public boolean previous() throws LdapException, CursorException
     {
-        checkNotClosed( "previous()" );
+        checkNotClosed();
 
         // if parked at -1 we cannot go backwards
         if ( index == -1 )
@@ -458,7 +458,7 @@ public class ListCursor<E> extends AbstractCursor<E>
     @Override
     public boolean next() throws LdapException, CursorException
     {
-        checkNotClosed( "next()" );
+        checkNotClosed();
 
         // if parked at -1 we advance to the start index and return true
         if ( !list.isEmpty() && ( index == -1 ) )
@@ -499,7 +499,7 @@ public class ListCursor<E> extends AbstractCursor<E>
     @Override
     public E get() throws CursorException
     {
-        checkNotClosed( "get()" );
+        checkNotClosed();
 
         if ( ( index < start ) || ( index >= end ) )
         {
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SetCursor.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SetCursor.java
index e907893..24695bb 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SetCursor.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SetCursor.java
@@ -141,7 +141,7 @@ public class SetCursor<E> extends AbstractCursor<E>
     @Override
     public void before( E element ) throws LdapException, CursorException
     {
-        checkNotClosed( "before()" );
+        checkNotClosed();
 
         if ( comparator == null )
         {
@@ -175,7 +175,7 @@ public class SetCursor<E> extends AbstractCursor<E>
     @Override
     public void after( E element ) throws LdapException, CursorException
     {
-        checkNotClosed( "after()" );
+        checkNotClosed();
 
         if ( comparator == null )
         {
@@ -209,7 +209,7 @@ public class SetCursor<E> extends AbstractCursor<E>
     @Override
     public void beforeFirst() throws LdapException, CursorException
     {
-        checkNotClosed( "beforeFirst()" );
+        checkNotClosed();
         this.index = -1;
     }
 
@@ -220,7 +220,7 @@ public class SetCursor<E> extends AbstractCursor<E>
     @Override
     public void afterLast() throws LdapException, CursorException
     {
-        checkNotClosed( "afterLast()" );
+        checkNotClosed();
         this.index = set.length;
     }
 
@@ -231,7 +231,7 @@ public class SetCursor<E> extends AbstractCursor<E>
     @Override
     public boolean first() throws LdapException, CursorException
     {
-        checkNotClosed( "first()" );
+        checkNotClosed();
 
         if ( set.length > 0 )
         {
@@ -250,7 +250,7 @@ public class SetCursor<E> extends AbstractCursor<E>
     @Override
     public boolean last() throws LdapException, CursorException
     {
-        checkNotClosed( "last()" );
+        checkNotClosed();
 
         if ( set.length > 0 )
         {
@@ -309,7 +309,7 @@ public class SetCursor<E> extends AbstractCursor<E>
     @Override
     public boolean previous() throws LdapException, CursorException
     {
-        checkNotClosed( "previous()" );
+        checkNotClosed();
 
         // if parked at -1 we cannot go backwards
         if ( index == -1 )
@@ -348,7 +348,7 @@ public class SetCursor<E> extends AbstractCursor<E>
     @Override
     public boolean next() throws LdapException, CursorException
     {
-        checkNotClosed( "next()" );
+        checkNotClosed();
 
         // if parked at -1 we advance to the start index and return true
         if ( ( set.length > 0 ) && ( index == -1 ) )
@@ -389,7 +389,7 @@ public class SetCursor<E> extends AbstractCursor<E>
     @Override
     public E get() throws CursorException
     {
-        checkNotClosed( "get()" );
+        checkNotClosed();
 
         if ( ( index < 0 ) || ( index >= set.length ) )
         {
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SingletonCursor.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SingletonCursor.java
index ae618a4..deb8d0e 100755
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SingletonCursor.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/cursor/SingletonCursor.java
@@ -105,7 +105,7 @@ public class SingletonCursor<E> extends AbstractCursor<E>
     @Override
     public void before( E element ) throws LdapException, CursorException
     {
-        checkNotClosed( "before()" );
+        checkNotClosed();
 
         if ( comparator == null )
         {
@@ -131,7 +131,7 @@ public class SingletonCursor<E> extends AbstractCursor<E>
     @Override
 public void after( E element ) throws LdapException, CursorException
     {
-        checkNotClosed( "after()" );
+        checkNotClosed();
 
         if ( comparator == null )
         {
@@ -157,7 +157,7 @@ public void after( E element ) throws LdapException, CursorException
     @Override
     public void beforeFirst() throws LdapException, CursorException
     {
-        checkNotClosed( "beforeFirst" );
+        checkNotClosed();
         beforeFirst = true;
         afterLast = false;
         onSingleton = false;
@@ -170,7 +170,7 @@ public void after( E element ) throws LdapException, CursorException
     @Override
     public void afterLast() throws LdapException, CursorException
     {
-        checkNotClosed( "afterLast" );
+        checkNotClosed();
         beforeFirst = false;
         afterLast = true;
         onSingleton = false;
@@ -183,7 +183,7 @@ public void after( E element ) throws LdapException, CursorException
     @Override
     public boolean first() throws LdapException, CursorException
     {
-        checkNotClosed( "first" );
+        checkNotClosed();
         beforeFirst = false;
         onSingleton = true;
         afterLast = false;
@@ -198,7 +198,7 @@ public void after( E element ) throws LdapException, CursorException
     @Override
     public boolean last() throws LdapException, CursorException
     {
-        checkNotClosed( "last" );
+        checkNotClosed();
         beforeFirst = false;
         onSingleton = true;
         afterLast = false;
@@ -253,7 +253,7 @@ public void after( E element ) throws LdapException, CursorException
     @Override
     public boolean previous() throws LdapException, CursorException
     {
-        checkNotClosed( "previous" );
+        checkNotClosed();
 
         if ( beforeFirst )
         {
@@ -284,7 +284,7 @@ public void after( E element ) throws LdapException, CursorException
     @Override
     public boolean next() throws LdapException, CursorException
     {
-        checkNotClosed( "next" );
+        checkNotClosed();
 
         if ( beforeFirst )
         {
@@ -315,7 +315,7 @@ public void after( E element ) throws LdapException, CursorException
     @Override
     public E get() throws CursorException
     {
-        checkNotClosed( "get" );
+        checkNotClosed();
 
         if ( onSingleton )
         {
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
index 5362c03..e30464a 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
@@ -1410,8 +1410,6 @@ public class Rdn implements Cloneable, Externalizable, Iterable<Ava>, Comparable
                                     bytes[pos++] = '#';
                                     break;
                                 }
-                            case '=':
-                                throw new IllegalArgumentException( I18n.err( I18n.ERR_04215 ) );
 
                             case ' ':
                                 if ( ( i == 0 ) || ( i == chars.length - 1 ) )
diff --git a/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java b/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java
index fb323f1..c88be37 100644
--- a/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java
+++ b/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java
@@ -674,9 +674,9 @@ public class DnParserTest
 
     
     @Test
-    public void testSameAttributeInDn() throws LdapInvalidDnException
+    public void testEqualInRdn() throws LdapInvalidDnException
     {
-        //Dn dn = new Dn( "l=eu + l=de + l=Berlin + l=Brandenburger Tor,dc=example,dc=org" );
+        Dn dn = new Dn( "uid=nghZwwtHgxgyvVbTQCYyeY\\+O4cc=,dc=example,dc=com" );
     }
     
     
diff --git a/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/RdnTest.java b/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/RdnTest.java
index f57e0a1..7899c40 100644
--- a/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/RdnTest.java
+++ b/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/RdnTest.java
@@ -764,6 +764,15 @@ public class RdnTest
 
 
     @Test
+    public void testUnescapeValueStringWithEqualInTheMiddle()
+    {
+        String res = ( String ) Rdn.unescapeValue( "a=b" );
+
+        assertEquals( "a=b", res );
+    }
+
+
+    @Test
     public void testEscapeValueString()
     {
         String res = Rdn.escapeValue( Strings.getBytesUtf8( "azerty" ) );

-- 
To stop receiving notification emails like this one, please contact
elecharny@apache.org.