Author: haint
Date: 2011-12-01 22:10:34 -0500 (Thu, 01 Dec 2011)
New Revision: 8188
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupMembershipForm.java
Log:
GTNPORTAL-2302 Exception when add over 10 user into group
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupMembershipForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupMembershipForm.java 2011-12-01
16:35:44 UTC (rev 8187)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupMembershipForm.java 2011-12-02
03:10:34 UTC (rev 8188)
@@ -47,6 +47,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
/**
@@ -191,7 +192,7 @@
OrganizationService service =
uiForm.getApplicationComponent(OrganizationService.class);
MembershipHandler memberShipHandler = service.getMembershipHandler();
UIApplication uiApp = event.getRequestContext().getUIApplication();
- List<String> userNames =
Arrays.asList(uiForm.getUserName().trim().split("\\s*,\\s*"));
+
Group group = userInGroup.getSelectedGroup();
MembershipType membershipType =
service.getMembershipTypeHandler().findMembershipType(uiForm.getMembership());
if (group == null)
@@ -201,19 +202,13 @@
}
// add new
- for (int i0 = 0; i0 < userNames.size() - 1; i0++)
+ List<String> userNames =
Arrays.asList(uiForm.getUserName().trim().split("\\s*,\\s*"));
+ if (new HashSet<String>(userNames).size() != userNames.size())
{
- String user0 = userNames.get(i0);
- if (user0 == null || user0.trim().length() == 0)
- continue;
- for (int i1 = i0 + 1; i1 < userNames.size(); i1++)
- if (user0.equals(userNames.get(i1)))
- {
- uiApp.addMessage(new
ApplicationMessage("UIGroupMembershipForm.msg.duplicate-user",
- new String[]{user0}));
- return;
- }
+ uiApp.addMessage(new
ApplicationMessage("UIGroupMembershipForm.msg.duplicate-user", null));
+ return;
}
+
// check user
boolean check = false;
String listNotExist = null;
Show replies by date