mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
Clean up exceptions
- Remove declared IOException - Fix repetition of exception messages
This commit is contained in:
@@ -59,7 +59,7 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
|
|||||||
* @throws E
|
* @throws E
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void create(T object) throws E, IOException;
|
public void create(T object) throws E;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a persistent object.
|
* Removes a persistent object.
|
||||||
@@ -70,7 +70,7 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
|
|||||||
* @throws E
|
* @throws E
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void delete(T object) throws E, IOException;
|
public void delete(T object) throws E;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies a persistent object.
|
* Modifies a persistent object.
|
||||||
@@ -81,5 +81,5 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
|
|||||||
* @throws E
|
* @throws E
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void modify(T object) throws E, IOException;
|
public void modify(T object) throws E;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
package sonia.scm;
|
package sonia.scm;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
@@ -56,9 +55,8 @@ public interface Manager<T extends ModelObject, E extends Exception>
|
|||||||
* @param object to refresh
|
* @param object to refresh
|
||||||
*
|
*
|
||||||
* @throws E
|
* @throws E
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
void refresh(T object) throws E, IOException;
|
void refresh(T object) throws E;
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ package sonia.scm;
|
|||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
@@ -78,7 +77,7 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void create(T object) throws E, IOException
|
public void create(T object) throws E
|
||||||
{
|
{
|
||||||
decorated.create(object);
|
decorated.create(object);
|
||||||
}
|
}
|
||||||
@@ -87,7 +86,7 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void delete(T object) throws E, IOException
|
public void delete(T object) throws E
|
||||||
{
|
{
|
||||||
decorated.delete(object);
|
decorated.delete(object);
|
||||||
}
|
}
|
||||||
@@ -105,7 +104,7 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void modify(T object) throws E, IOException
|
public void modify(T object) throws E
|
||||||
{
|
{
|
||||||
decorated.modify(object);
|
decorated.modify(object);
|
||||||
}
|
}
|
||||||
@@ -114,7 +113,7 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void refresh(T object) throws E, IOException
|
public void refresh(T object) throws E
|
||||||
{
|
{
|
||||||
decorated.refresh(object);
|
decorated.refresh(object);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ public class GroupAlreadyExistsException extends GroupException
|
|||||||
/**
|
/**
|
||||||
* Constructs a new instance.
|
* Constructs a new instance.
|
||||||
*
|
*
|
||||||
* @param message exception message
|
* @param name The name (aka id) of the group
|
||||||
*/
|
*/
|
||||||
public GroupAlreadyExistsException(String message) {
|
public GroupAlreadyExistsException(String name) {
|
||||||
super(message);
|
super(name + " group already exists");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,39 +52,7 @@ public class GroupNotFoundException extends GroupException
|
|||||||
* Constructs a new GroupNotFoundException.
|
* Constructs a new GroupNotFoundException.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public GroupNotFoundException() {}
|
public GroupNotFoundException() {
|
||||||
|
super("group does not exists");
|
||||||
/**
|
|
||||||
* Constructs a new GroupNotFoundException.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param message message for the exception
|
|
||||||
*/
|
|
||||||
public GroupNotFoundException(String message)
|
|
||||||
{
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new GroupNotFoundException.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param throwable root cause
|
|
||||||
*/
|
|
||||||
public GroupNotFoundException(Throwable throwable)
|
|
||||||
{
|
|
||||||
super(throwable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new GroupNotFoundException.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param message message for the exception
|
|
||||||
* @param throwable root cause
|
|
||||||
*/
|
|
||||||
public GroupNotFoundException(String message, Throwable throwable)
|
|
||||||
{
|
|
||||||
super(message, throwable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,23 +38,20 @@ package sonia.scm.repository;
|
|||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.google.common.io.Resources;
|
import com.google.common.io.Resources;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.ConfigurationException;
|
import sonia.scm.ConfigurationException;
|
||||||
import sonia.scm.io.CommandResult;
|
import sonia.scm.io.CommandResult;
|
||||||
import sonia.scm.io.ExtendedCommand;
|
import sonia.scm.io.ExtendedCommand;
|
||||||
import sonia.scm.io.FileSystem;
|
import sonia.scm.io.FileSystem;
|
||||||
|
import sonia.scm.store.ConfigurationStoreFactory;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import sonia.scm.store.ConfigurationStoreFactory;
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -109,7 +106,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void create(Repository repository)
|
public void create(Repository repository)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException
|
||||||
{
|
{
|
||||||
File directory = getDirectory(repository);
|
File directory = getDirectory(repository);
|
||||||
|
|
||||||
@@ -137,11 +134,14 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
|||||||
directory);
|
directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
fileSystem.destroy(directory);
|
try {
|
||||||
|
fileSystem.destroy(directory);
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("could not delete directory after failed repository creation: {}", directory, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Throwables.propagateIfPossible(ex, RepositoryException.class,
|
Throwables.propagateIfPossible(ex, RepositoryException.class);
|
||||||
IOException.class);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,14 +173,17 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
|||||||
* @throws RepositoryException
|
* @throws RepositoryException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void delete(Repository repository)
|
public void delete(Repository repository) throws RepositoryException
|
||||||
throws RepositoryException, IOException
|
|
||||||
{
|
{
|
||||||
File directory = getDirectory(repository);
|
File directory = getDirectory(repository);
|
||||||
|
|
||||||
if (directory.exists())
|
if (directory.exists())
|
||||||
{
|
{
|
||||||
fileSystem.destroy(directory);
|
try {
|
||||||
|
fileSystem.destroy(directory);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RepositoryException("could not delete repository", e);
|
||||||
|
}
|
||||||
cleanupEmptyDirectories(config.getRepositoryDirectory(),
|
cleanupEmptyDirectories(config.getRepositoryDirectory(),
|
||||||
directory.getParentFile());
|
directory.getParentFile());
|
||||||
}
|
}
|
||||||
@@ -232,8 +235,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
|||||||
* @throws RepositoryException
|
* @throws RepositoryException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void modify(Repository repository)
|
public void modify(Repository repository) throws RepositoryException
|
||||||
throws RepositoryException, IOException
|
|
||||||
{
|
{
|
||||||
|
|
||||||
// nothing todo
|
// nothing todo
|
||||||
|
|||||||
@@ -30,12 +30,10 @@ package sonia.scm.security;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
import org.apache.shiro.authc.AuthenticationInfo;
|
import org.apache.shiro.authc.AuthenticationInfo;
|
||||||
import org.apache.shiro.authc.SimpleAuthenticationInfo;
|
import org.apache.shiro.authc.SimpleAuthenticationInfo;
|
||||||
import org.apache.shiro.subject.SimplePrincipalCollection;
|
import org.apache.shiro.subject.SimplePrincipalCollection;
|
||||||
|
|
||||||
import sonia.scm.group.Group;
|
import sonia.scm.group.Group;
|
||||||
import sonia.scm.group.GroupException;
|
import sonia.scm.group.GroupException;
|
||||||
import sonia.scm.group.GroupManager;
|
import sonia.scm.group.GroupManager;
|
||||||
@@ -46,9 +44,6 @@ import sonia.scm.user.UserException;
|
|||||||
import sonia.scm.user.UserManager;
|
import sonia.scm.user.UserManager;
|
||||||
import sonia.scm.web.security.AdministrationContext;
|
import sonia.scm.web.security.AdministrationContext;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -134,7 +129,7 @@ public final class SyncingRealmHelper {
|
|||||||
groupManager.create(group);
|
groupManager.create(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (GroupException | IOException ex) {
|
catch (GroupException ex) {
|
||||||
throw new AuthenticationException("could not store group", ex);
|
throw new AuthenticationException("could not store group", ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -155,7 +150,7 @@ public final class SyncingRealmHelper {
|
|||||||
userManager.create(user);
|
userManager.create(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (UserException | IOException ex) {
|
catch (UserException ex) {
|
||||||
throw new AuthenticationException("could not store user", ex);
|
throw new AuthenticationException("could not store user", ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ public class UserAlreadyExistsException extends UserException
|
|||||||
/**
|
/**
|
||||||
* Constructs a new instance.
|
* Constructs a new instance.
|
||||||
*
|
*
|
||||||
* @param message message of exception
|
* @param name The name (aka id) of the user
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
public UserAlreadyExistsException(String message)
|
public UserAlreadyExistsException(String name)
|
||||||
{
|
{
|
||||||
super(message);
|
super(name + " user already exists");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,39 +51,7 @@ public class UserNotFoundException extends UserException
|
|||||||
* Constructs a new UserNotFoundException.
|
* Constructs a new UserNotFoundException.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public UserNotFoundException() {}
|
public UserNotFoundException() {
|
||||||
|
super("user does not exists");
|
||||||
/**
|
|
||||||
* Constructs a new UserNotFoundException.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param message message for the exception
|
|
||||||
*/
|
|
||||||
public UserNotFoundException(String message)
|
|
||||||
{
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new UserNotFoundException.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param throwable root cause
|
|
||||||
*/
|
|
||||||
public UserNotFoundException(Throwable throwable)
|
|
||||||
{
|
|
||||||
super(throwable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new UserNotFoundException.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param message message for the exception
|
|
||||||
* @param throwable root cause
|
|
||||||
*/
|
|
||||||
public UserNotFoundException(String message, Throwable throwable)
|
|
||||||
{
|
|
||||||
super(message, throwable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,12 +40,13 @@ import com.google.common.base.Strings;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import com.webcohesion.enunciate.metadata.rs.ResponseCode;
|
||||||
|
import com.webcohesion.enunciate.metadata.rs.ResponseHeader;
|
||||||
|
import com.webcohesion.enunciate.metadata.rs.StatusCodes;
|
||||||
|
import com.webcohesion.enunciate.metadata.rs.TypeHint;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.NotSupportedFeatuerException;
|
import sonia.scm.NotSupportedFeatuerException;
|
||||||
import sonia.scm.Type;
|
import sonia.scm.Type;
|
||||||
import sonia.scm.api.rest.RestActionUploadResult;
|
import sonia.scm.api.rest.RestActionUploadResult;
|
||||||
@@ -65,26 +66,6 @@ import sonia.scm.repository.api.UnbundleCommandBuilder;
|
|||||||
import sonia.scm.security.Role;
|
import sonia.scm.security.Role;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.*;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import com.webcohesion.enunciate.metadata.rs.ResponseCode;
|
|
||||||
import com.webcohesion.enunciate.metadata.rs.ResponseHeader;
|
|
||||||
import com.webcohesion.enunciate.metadata.rs.StatusCodes;
|
|
||||||
import com.webcohesion.enunciate.metadata.rs.TypeHint;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.DefaultValue;
|
import javax.ws.rs.DefaultValue;
|
||||||
import javax.ws.rs.FormParam;
|
import javax.ws.rs.FormParam;
|
||||||
@@ -100,10 +81,22 @@ import javax.ws.rs.core.GenericEntity;
|
|||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.UriInfo;
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rest resource for importing repositories.
|
* Rest resource for importing repositories.
|
||||||
@@ -564,10 +557,6 @@ public class RepositoryImportResource
|
|||||||
{
|
{
|
||||||
handleGenericCreationFailure(ex, type, name);
|
handleGenericCreationFailure(ex, type, name);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
handleGenericCreationFailure(ex, type, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return repository;
|
return repository;
|
||||||
}
|
}
|
||||||
@@ -716,10 +705,6 @@ public class RepositoryImportResource
|
|||||||
{
|
{
|
||||||
manager.delete(repository);
|
manager.delete(repository);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
logger.error("can not delete repository", e);
|
|
||||||
}
|
|
||||||
catch (RepositoryException e)
|
catch (RepositoryException e)
|
||||||
{
|
{
|
||||||
logger.error("can not delete repository", e);
|
logger.error("can not delete repository", e);
|
||||||
|
|||||||
@@ -210,9 +210,9 @@ public class RepositoryResource extends AbstractManagerResource<Repository, Repo
|
|||||||
logger.warn("delete not allowed", ex);
|
logger.warn("delete not allowed", ex);
|
||||||
response = Response.status(Response.Status.FORBIDDEN).build();
|
response = Response.status(Response.Status.FORBIDDEN).build();
|
||||||
}
|
}
|
||||||
catch (RepositoryException | IOException ex)
|
catch (RepositoryException ex)
|
||||||
{
|
{
|
||||||
logger.error("error during create", ex);
|
logger.error("error during delete", ex);
|
||||||
response = createErrorResponse(ex);
|
response = createErrorResponse(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,12 @@ import sonia.scm.util.CollectionAppender;
|
|||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
@@ -106,7 +111,7 @@ public class DefaultGroupManager extends AbstractGroupManager
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void create(Group group) throws GroupException, IOException
|
public void create(Group group) throws GroupException
|
||||||
{
|
{
|
||||||
String type = group.getType();
|
String type = group.getType();
|
||||||
|
|
||||||
@@ -127,7 +132,7 @@ public class DefaultGroupManager extends AbstractGroupManager
|
|||||||
|
|
||||||
if (groupDAO.contains(name))
|
if (groupDAO.contains(name))
|
||||||
{
|
{
|
||||||
throw new GroupAlreadyExistsException(name.concat(" group already exists"));
|
throw new GroupAlreadyExistsException(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeDuplicateMembers(group);
|
removeDuplicateMembers(group);
|
||||||
@@ -147,7 +152,7 @@ public class DefaultGroupManager extends AbstractGroupManager
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void delete(Group group) throws GroupException, IOException
|
public void delete(Group group) throws GroupException
|
||||||
{
|
{
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
@@ -166,7 +171,7 @@ public class DefaultGroupManager extends AbstractGroupManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new GroupNotFoundException("user does not exists");
|
throw new GroupNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +194,7 @@ public class DefaultGroupManager extends AbstractGroupManager
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void modify(Group group) throws GroupException, IOException
|
public void modify(Group group) throws GroupException
|
||||||
{
|
{
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
@@ -212,7 +217,7 @@ public class DefaultGroupManager extends AbstractGroupManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new GroupNotFoundException("group does not exists");
|
throw new GroupNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +231,7 @@ public class DefaultGroupManager extends AbstractGroupManager
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void refresh(Group group) throws GroupException, IOException
|
public void refresh(Group group) throws GroupException
|
||||||
{
|
{
|
||||||
String name = group.getName();
|
String name = group.getName();
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
@@ -239,7 +244,7 @@ public class DefaultGroupManager extends AbstractGroupManager
|
|||||||
|
|
||||||
if (fresh == null)
|
if (fresh == null)
|
||||||
{
|
{
|
||||||
throw new GroupNotFoundException("group does not exists");
|
throw new GroupNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
fresh.copyProperties(group);
|
fresh.copyProperties(group);
|
||||||
|
|||||||
@@ -41,12 +41,9 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import org.apache.shiro.concurrent.SubjectAwareExecutorService;
|
import org.apache.shiro.concurrent.SubjectAwareExecutorService;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.ArgumentIsInvalidException;
|
import sonia.scm.ArgumentIsInvalidException;
|
||||||
import sonia.scm.ConfigurationException;
|
import sonia.scm.ConfigurationException;
|
||||||
import sonia.scm.HandlerEventType;
|
import sonia.scm.HandlerEventType;
|
||||||
@@ -60,10 +57,8 @@ import sonia.scm.util.HttpUtil;
|
|||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@@ -76,7 +71,7 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation of {@link RepositoryManager}.
|
* Default implementation of {@link RepositoryManager}.
|
||||||
@@ -164,7 +159,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
|
|||||||
* @throws RepositoryException
|
* @throws RepositoryException
|
||||||
*/
|
*/
|
||||||
public void create(Repository repository, boolean initRepository)
|
public void create(Repository repository, boolean initRepository)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException
|
||||||
{
|
{
|
||||||
logger.info("create repository {} of type {}", repository.getName(),
|
logger.info("create repository {} of type {}", repository.getName(),
|
||||||
repository.getType());
|
repository.getType());
|
||||||
@@ -201,7 +196,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void create(Repository repository)
|
public void create(Repository repository)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException
|
||||||
{
|
{
|
||||||
create(repository, true);
|
create(repository, true);
|
||||||
}
|
}
|
||||||
@@ -217,7 +212,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void delete(Repository repository)
|
public void delete(Repository repository)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException
|
||||||
{
|
{
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
@@ -283,7 +278,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void modify(Repository repository)
|
public void modify(Repository repository)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException
|
||||||
{
|
{
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
@@ -323,7 +318,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void refresh(Repository repository)
|
public void refresh(Repository repository)
|
||||||
throws RepositoryException, IOException
|
throws RepositoryException
|
||||||
{
|
{
|
||||||
AssertUtil.assertIsNotNull(repository);
|
AssertUtil.assertIsNotNull(repository);
|
||||||
RepositoryPermissions.read(repository).check();
|
RepositoryPermissions.read(repository).check();
|
||||||
|
|||||||
@@ -35,10 +35,8 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.EagerSingleton;
|
import sonia.scm.EagerSingleton;
|
||||||
import sonia.scm.plugin.Extension;
|
import sonia.scm.plugin.Extension;
|
||||||
import sonia.scm.web.security.AdministrationContext;
|
import sonia.scm.web.security.AdministrationContext;
|
||||||
@@ -46,8 +44,6 @@ import sonia.scm.web.security.PrivilegedAction;
|
|||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -154,7 +150,7 @@ public final class LastModifiedUpdateListener
|
|||||||
{
|
{
|
||||||
repositoryManager.modify(dbr);
|
repositoryManager.modify(dbr);
|
||||||
}
|
}
|
||||||
catch (RepositoryException | IOException ex)
|
catch (RepositoryException ex)
|
||||||
{
|
{
|
||||||
logger.error("could not modify repository", ex);
|
logger.error("could not modify repository", ex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ public class DefaultUserManager extends AbstractUserManager
|
|||||||
* @throws UserException
|
* @throws UserException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void create(User user) throws UserException, IOException
|
public void create(User user) throws UserException
|
||||||
{
|
{
|
||||||
String type = user.getType();
|
String type = user.getType();
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ public class DefaultUserManager extends AbstractUserManager
|
|||||||
|
|
||||||
if (userDAO.contains(user.getName()))
|
if (userDAO.contains(user.getName()))
|
||||||
{
|
{
|
||||||
throw new UserAlreadyExistsException(user.getName().concat(" user already exists"));
|
throw new UserAlreadyExistsException(user.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
AssertUtil.assertIsValid(user);
|
AssertUtil.assertIsValid(user);
|
||||||
@@ -175,7 +175,7 @@ public class DefaultUserManager extends AbstractUserManager
|
|||||||
* @throws UserException
|
* @throws UserException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void delete(User user) throws UserException, IOException
|
public void delete(User user) throws UserException
|
||||||
{
|
{
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
@@ -193,7 +193,7 @@ public class DefaultUserManager extends AbstractUserManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new UserNotFoundException("user does not exists");
|
throw new UserNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ public class DefaultUserManager extends AbstractUserManager
|
|||||||
* @throws UserException
|
* @throws UserException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void modify(User user) throws UserException, IOException
|
public void modify(User user) throws UserException
|
||||||
{
|
{
|
||||||
String name = user.getName();
|
String name = user.getName();
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
@@ -245,7 +245,7 @@ public class DefaultUserManager extends AbstractUserManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new UserNotFoundException("user does not exists");
|
throw new UserNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ public class DefaultUserManager extends AbstractUserManager
|
|||||||
* @throws UserException
|
* @throws UserException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void refresh(User user) throws UserException, IOException
|
public void refresh(User user) throws UserException
|
||||||
{
|
{
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
{
|
{
|
||||||
@@ -271,7 +271,7 @@ public class DefaultUserManager extends AbstractUserManager
|
|||||||
|
|
||||||
if (fresh == null)
|
if (fresh == null)
|
||||||
{
|
{
|
||||||
throw new UserNotFoundException("user does not exists");
|
throw new UserNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
fresh.copyProperties(user);
|
fresh.copyProperties(user);
|
||||||
|
|||||||
Reference in New Issue
Block a user