directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1554625 - /directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
Date Wed, 01 Jan 2014 14:33:18 GMT
Author: kayyagari
Date: Wed Jan  1 14:33:17 2014
New Revision: 1554625

URL: http://svn.apache.org/r1554625
Log:
sort only when more than one element is present

Modified:
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java

Modified: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java?rev=1554625&r1=1554624&r2=1554625&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
(original)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
Wed Jan  1 14:33:17 2014
@@ -1303,6 +1303,20 @@ public class DefaultCoreSession implemen
     {
         unsortedEntries.beforeFirst();
         
+        Entry first = null;
+        
+        if( unsortedEntries.next() )
+        {
+            first = unsortedEntries.get();
+        }
+        
+        if( !unsortedEntries.next() )
+        {
+            unsortedEntries.beforeFirst();
+            
+            return unsortedEntries;
+        }
+        
         SortKey sk = control.getSortKeys().get( 0 );
         
         AttributeType at = schemaManager.getAttributeType( sk.getAttributeTypeDesc() );
@@ -1330,6 +1344,11 @@ public class DefaultCoreSession implemen
             throw new LdapException( e );
         }
         
+        btree.insert( first, null );
+        
+        // at this stage the cursor will be _on_ the next element, so read it
+        btree.insert( unsortedEntries.get(), null );
+        
         while( unsortedEntries.next() )
         {
             Entry entry = unsortedEntries.get();



Mime
View raw message