directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r951507 - /directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/CursorList.java
Date Fri, 04 Jun 2010 17:52:49 GMT
Author: felixk
Date: Fri Jun  4 17:52:49 2010
New Revision: 951507

URL: http://svn.apache.org/viewvc?rev=951507&view=rev
Log:
Avoid NPE if list==null

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/CursorList.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/CursorList.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/CursorList.java?rev=951507&r1=951506&r2=951507&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/CursorList.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/filtering/CursorList.java
Fri Jun  4 17:52:49 2010
@@ -83,32 +83,32 @@ public class CursorList implements Entry
      */
     public CursorList( int start, List<EntryFilteringCursor> list, int end, SearchingOperationContext
opContext )
     {
-        if ( ( start < 0 ) || ( start > list.size() ) )
+        if ( list != null )
+        {
+            this.list = list;
+        }
+        else
+        {
+            this.list = Collections.emptyList();
+        }
+
+        if ( ( start < 0 ) || ( start > this.list.size() ) )
         {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_02005, start ) );
         }
 
-        if ( ( end < 0 ) || ( end > list.size() ) )
+        if ( ( end < 0 ) || ( end > this.list.size() ) )
         {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_02006, end ) );
         }
 
         // check list is not empty list since the empty list is the only situation
         // where we allow for start to equal the end: in other cases it makes no sense
-        if ( ( list.size() > 0 ) && ( start >= end ) )
+        if ( ( this.list.size() > 0 ) && ( start >= end ) )
         {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_02007, start, end ) );
         }
 
-        if ( list != null )
-        {
-            this.list = list;
-        }
-        else
-        {
-            this.list = Collections.emptyList();
-        }
-
         this.start = start;
         this.end = end;
         this.opContext = opContext;



Mime
View raw message