directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 20746 - incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/profile
Date Wed, 02 Jun 2004 01:39:52 GMT
Author: akarasulu
Date: Tue Jun  1 18:39:51 2004
New Revision: 20746

Modified:
   incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/profile/JeProfileRoleLinkDAO.java
Log:
Found bug where lack of records produces an exception.  This should not be the
case.  Instead an empty cursor should be returned.


Modified: incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/profile/JeProfileRoleLinkDAO.java
==============================================================================
--- incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/profile/JeProfileRoleLinkDAO.java
(original)
+++ incubator/directory/rms/trunk/je/src/java/org/apache/rms/je/profile/JeProfileRoleLinkDAO.java
Tue Jun  1 18:39:51 2004
@@ -28,6 +28,8 @@
 import org.apache.rms.je.sequence.Sequence ;
 
 import org.apache.commons.lang.Validate ;
+import org.apache.commons.collections.IteratorUtils;
+import org.apache.commons.collections.iterators.EmptyIterator;
 
 import java.util.*;
 
@@ -554,7 +556,17 @@
             // ---------------------------------------------------------------
 
             appNameCursor = byAppName.openSecondaryCursor( null, null ) ;
-            status = appNameCursor.getSearchKey( appNameKey, value, LockMode.DEFAULT ) ;
+            status = appNameCursor.getSearchKey( appNameKey, value,
+                    LockMode.DEFAULT ) ;
+
+            if ( status == OperationStatus.NOTFOUND )
+            {
+                closeNoError( cursor ) ;
+                closeNoError( appNameCursor ) ;
+                closeNoError( userNameCursor ) ;
+                return EmptyIterator.INSTANCE ;
+            }
+
             if ( status != OperationStatus.SUCCESS )
             {
                 monitor.failedToListRoleNames( this, status, appName, userName ) ;
@@ -569,6 +581,15 @@
             userNameCursor = byUserName.openSecondaryCursor( null, null ) ;
             status = userNameCursor.getSearchKey( userNameKey, value,
                     LockMode.DEFAULT ) ;
+
+            if ( status == OperationStatus.NOTFOUND )
+            {
+                closeNoError( cursor ) ;
+                closeNoError( appNameCursor ) ;
+                closeNoError( userNameCursor ) ;
+                return EmptyIterator.INSTANCE ;
+            }
+
             if ( status != OperationStatus.SUCCESS )
             {
                 monitor.failedToListRoleNames( this, status, appName,

Mime
View raw message