deepyaraj commented on a change in pull request #88:
URL: https://github.com/apache/qpid-broker-j/pull/88#discussion_r645469101
##########
File path:
broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java
##########
@@ -174,10 +179,27 @@ public synchronized void removeUserFromGroup(String user,
String group)
@Override
public synchronized void createGroup(String group)
{
- Set<String> users = new ConcurrentSkipListSet<String>();
- _groupToUserMap.put(group, users);
+ if (!isAvailable(group, _groupToUserMap))
+ {
+ Set<String> users = new ConcurrentSkipListSet<String>();
+ _groupToUserMap.put(group, users);
+ update();
+ }
+ else
+ {
+ throw new IllegalConfigurationException(String.format("Group with
name '%s' already exists", group));
+ }
+ }
- update();
+ private boolean isAvailable(String searchString,
+ final Map<String, Set<String>> collection)
+ {
+ String groupAvailable = keySearch(collection.keySet(), searchString);
+ if (collection.get(groupAvailable) == null && groupAvailable ==
searchString)
Review comment:
Done!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]