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 2007/05/18 21:32:27 UTC

svn commit: r539571 - /directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexComparator.java

Author: elecharny
Date: Fri May 18 12:32:25 2007
New Revision: 539571

URL: http://svn.apache.org/viewvc?view=rev&rev=539571
Log:
Replaced some call to a LongComparator method when a simple
local implementation can do the trick.

Modified:
    directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexComparator.java

Modified: directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexComparator.java?view=diff&rev=539571&r1=539570&r2=539571
==============================================================================
--- directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexComparator.java (original)
+++ directory/apacheds/trunk/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexComparator.java Fri May 18 12:32:25 2007
@@ -21,7 +21,6 @@
 
 
 import org.apache.directory.server.schema.SerializableComparator;
-import org.apache.directory.shared.ldap.util.LongComparator;
 
 /**
  * TupleComparator for index records.
@@ -41,7 +40,23 @@
 
         public int compare( Object o1, Object o2 )
         {
-            return LongComparator.INSTANCE.compare( o1, o2 );
+        	try
+        	{
+	        	long thisVal = (Long)o1;
+	        	long anotherVal = (Long)o2;
+	        	return ( thisVal < anotherVal ? -1 : ( thisVal == anotherVal ? 0 : 1 ) );
+        	}
+        	catch ( NullPointerException npe )
+        	{
+    	        if ( o1 == null )
+    	        {
+    	            throw new IllegalArgumentException( "Argument 'obj1' is null" );
+    	        }
+    	        else
+    	        {
+    	            throw new IllegalArgumentException( "Argument 'obj2' is null" );
+    	        }
+        	}
         }
     };