// 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);
+ }
}
}