public Group createGroup(Principal principal, String intermediatePath) throws AuthorizableExistsException, RepositoryException {
if (!isValidPrincipal(principal)) {
throw new IllegalArgumentException("Cannot create Group: Principal may not be null and must have a valid name.");
}
if (hasAuthorizableOrReferee(principal)) {
throw new AuthorizableExistsException("Authorizable for '" + principal.getName() + "' already exists: ");
}
NodeImpl parent = null;
try {
String parentPath = getParentPath(intermediatePath, GROUPS_PATH);