directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1626936 - /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java
Date Tue, 23 Sep 2014 04:27:29 GMT
Author: elecharny
Date: Tue Sep 23 04:27:28 2014
New Revision: 1626936

URL: http://svn.apache.org/r1626936
Log:
Fixed for MAVIBOT-42 : we now create a new instance for each resulting tuple instead of using
a class instance

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java?rev=1626936&r1=1626935&r2=1626936&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java
Tue Sep 23 04:27:28 2014
@@ -54,9 +54,6 @@ public class TupleCursor<K, V>
     /** The transaction used for this cursor */
     protected ReadTransaction<K, V> transaction;
 
-    /** The Tuple used to return the results */
-    protected Tuple<K, V> tuple = new Tuple<K, V>();
-
 
     /**
      * Creates a new instance of Cursor.
@@ -322,8 +319,7 @@ public class TupleCursor<K, V>
         }
 
         AbstractPage<K, V> leaf = ( AbstractPage<K, V> ) ( parentPos.page );
-        tuple.setKey( leaf.getKey( parentPos.pos ) );
-        tuple.setValue( value );
+        Tuple<K, V> tuple = new Tuple<K, V>( leaf.getKey( parentPos.pos ), value
);
 
         return tuple;
     }
@@ -396,6 +392,7 @@ public class TupleCursor<K, V>
 
         // The key
         AbstractPage<K, V> leaf = ( AbstractPage<K, V> ) ( parentPos.page );
+        Tuple<K, V> tuple = new Tuple<K, V>();
         tuple.setKey( leaf.getKey( parentPos.pos ) );
 
         // The value
@@ -595,8 +592,7 @@ public class TupleCursor<K, V>
         }
 
         AbstractPage<K, V> leaf = ( AbstractPage<K, V> ) ( parentPos.page );
-        tuple.setKey( leaf.getKey( parentPos.pos ) );
-        tuple.setValue( value );
+        Tuple<K, V> tuple = new Tuple<K, V>( leaf.getKey( parentPos.pos ), value
);
 
         return tuple;
     }
@@ -665,6 +661,7 @@ public class TupleCursor<K, V>
         AbstractPage<K, V> leaf = ( AbstractPage<K, V> ) ( parentPos.page );
 
         // The key
+        Tuple<K, V> tuple = new Tuple<K, V>();
         tuple.setKey( leaf.getKey( parentPos.pos ) );
 
         // The value
@@ -703,16 +700,16 @@ public class TupleCursor<K, V>
 
         switch ( parentPos.pos )
         {
-            case 0 :
+            case 0:
                 // Beginning of the leaf. We have to go back into the stack up to the
                 // parent, and down to the leaf
                 return hasPrevParentPos();
-                
-            case -1 :
+
+            case -1:
                 // no previous key
                 return false;
-                
-            default :
+
+            default:
                 // we have a previous key
                 return true;
         }



Mime
View raw message