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:30:17 UTC

svn commit: r539570 - /directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java

Author: elecharny
Date: Fri May 18 12:30:15 2007
New Revision: 539570

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

Modified:
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java?view=diff&rev=539570&r1=539569&r2=539570
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java Fri May 18 12:30:15 2007
@@ -25,14 +25,10 @@
 
 import jdbm.RecordManager;
 import jdbm.helper.LongSerializer;
-import jdbm.helper.Serializer;
 import jdbm.helper.StringComparator;
 
 import org.apache.directory.server.core.partition.impl.btree.MasterTable;
 import org.apache.directory.server.schema.SerializableComparator;
-//import org.apache.directory.shared.ldap.util.BigIntegerComparator;
-import org.apache.directory.shared.ldap.util.AttributesSerializerUtils;
-import org.apache.directory.shared.ldap.util.LongComparator;
 
 
 /**
@@ -52,7 +48,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" );
+    	        }
+        	}
         }
     };
     private static final SerializableComparator STRING_COMPARATOR = new SerializableComparator(