directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1382107 - /directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java
Date Fri, 07 Sep 2012 18:13:06 GMT
Author: elecharny
Date: Fri Sep  7 18:13:05 2012
New Revision: 1382107

URL: http://svn.apache.org/viewvc?rev=1382107&view=rev
Log:
Fixed NPE in the comparator, when the "count" is not stored in the Node

Modified:
    directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java

Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java?rev=1382107&r1=1382106&r2=1382107&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java
(original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ScanCountComparator.java
Fri Sep  7 18:13:05 2012
@@ -39,8 +39,20 @@ public class ScanCountComparator impleme
      */
     public int compare( Evaluator<?> e1, Evaluator<?> e2 )
     {
-        long scanCount1 = ( Long ) e1.getExpression().get( "count" );
-        long scanCount2 = ( Long ) e2.getExpression().get( "count" );
+        Object count1 = e1.getExpression().get( "count" );;
+        Object count2 = e2.getExpression().get( "count" );;
+        long scanCount1 = Long.MAX_VALUE;
+        long scanCount2 = Long.MAX_VALUE;
+
+        if ( count1 != null )
+        {
+            scanCount1 = ( Long ) e1.getExpression().get( "count" );
+        }
+
+        if ( count2 != null )
+        {
+            scanCount2 = ( Long ) e2.getExpression().get( "count" );
+        }
 
         if ( scanCount1 == scanCount2 )
         {
@@ -60,5 +72,4 @@ public class ScanCountComparator impleme
 
         return 1;
     }
-
 }



Mime
View raw message