]> git.mxchange.org Git - addressbook-ejb.git/commitdiff
nope, contains() did not work, sadly :-(
authorRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 13:10:56 +0000 (15:10 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 13:10:56 +0000 (15:10 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java

index 1888db04300b3782884fea00b6fb5bfb7ef6f90e..4d2869dcdb39e1ce82edafcb4af18f8ffcab63cf 100644 (file)
@@ -116,14 +116,32 @@ public class AddressbookSessionBean extends BaseDatabaseBean implements Addressb
                        // Log message
                        this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: u={0}", u)); //NOI18N
 
-                       // Is this user not included?
-                       if (!allSharees.contains(u)) {
-                               // Found one to add!
-                               // Log message
-                               this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: u={0} - ADDING!", u)); //NOI18N
-
-                               // Add it
-                               userList.add(u);
+                       // Some entries in allSharees?
+                       if (!allSharees.isEmpty()) {
+                               // Default is not found
+                               boolean isFound = false;
+
+                               // Check all entries (user name matching)
+                               for (final User sharee : allSharees) {
+                                       // Debug message
+                                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: sharee={0}", sharee));
+
+                                       // Does it match?
+                                       if (sharee.equals(u)) {
+                                               // Skip this one
+                                               isFound = true;
+                                               break;
+                                       }
+                               }
+
+                               // Still not found?
+                               if (!isFound) {
+                                       // Found one to add
+                                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("allUsersNotSharing: u={0} - ADDING!", u)); //NOI18N
+
+                                       // Add it
+                                       userList.add(u);
+                               }
                        }
                }