directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1536069 - /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/Leaf.java
Date Sun, 27 Oct 2013 09:04:06 GMT
Author: elecharny
Date: Sun Oct 27 09:04:05 2013
New Revision: 1536069

URL: http://svn.apache.org/r1536069
Log:
Speedup : throw a static exception when a key is not found, instead of creating a new one

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

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/Leaf.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/Leaf.java?rev=1536069&r1=1536068&r2=1536069&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/Leaf.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/Leaf.java
Sun Oct 27 09:04:05 2013
@@ -45,6 +45,10 @@ import org.apache.directory.mavibot.btre
     /** Values associated with keys */
     protected ValueHolder<V>[] values;
 
+    /** A static Exception used to avoid creating a new one every time */
+    private KeyNotFoundException KEY_NOT_FOUND_EXCEPTION = new KeyNotFoundException(
+        "Cannot find an entry associated with this key" );
+
 
     /**
      * Constructor used to create a new Leaf when we read it from a file.
@@ -495,7 +499,7 @@ import org.apache.directory.mavibot.btre
         }
         else
         {
-            throw new KeyNotFoundException( "Cannot find an entry for key " + key );
+            throw KEY_NOT_FOUND_EXCEPTION;
         }
     }
 
@@ -537,7 +541,7 @@ import org.apache.directory.mavibot.btre
         }
         else
         {
-            throw new KeyNotFoundException( "Cannot find an entry for key " + key );
+            throw KEY_NOT_FOUND_EXCEPTION;
         }
     }
 



Mime
View raw message