Merge base branch into feature

This commit is contained in:
René Pfeuffer
2018-07-05 14:56:33 +02:00
28 changed files with 270 additions and 250 deletions

View File

@@ -55,7 +55,7 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
*
* @return The persisted object.
*/
public T create(T object) throws E, IOException;
public T create(T object) throws E;
/**
* Removes a persistent object.
@@ -66,7 +66,7 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
* @throws E
* @throws IOException
*/
public void delete(T object) throws E, IOException;
public void delete(T object) throws E;
/**
* Modifies a persistent object.
@@ -77,5 +77,5 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
* @throws E
* @throws IOException
*/
public void modify(T object) throws E, IOException;
public void modify(T object) throws E;
}

View File

@@ -33,7 +33,6 @@
package sonia.scm;
import java.io.IOException;
import java.util.Collection;
import java.util.Comparator;
@@ -56,9 +55,8 @@ public interface Manager<T extends ModelObject, E extends Exception>
* @param object to refresh
*
* @throws E
* @throws IOException
*/
void refresh(T object) throws E, IOException;
void refresh(T object) throws E;
//~--- get methods ----------------------------------------------------------

View File

@@ -77,7 +77,7 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
* {@inheritDoc}
*/
@Override
public T create(T object) throws E, IOException
public T create(T object) throws E
{
return decorated.create(object);
}
@@ -86,7 +86,7 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
* {@inheritDoc}
*/
@Override
public void delete(T object) throws E, IOException
public void delete(T object) throws E
{
decorated.delete(object);
}
@@ -104,7 +104,7 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
* {@inheritDoc}
*/
@Override
public void modify(T object) throws E, IOException
public void modify(T object) throws E
{
decorated.modify(object);
}
@@ -113,7 +113,7 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
* {@inheritDoc}
*/
@Override
public void refresh(T object) throws E, IOException
public void refresh(T object) throws E
{
decorated.refresh(object);
}

View File

@@ -48,9 +48,9 @@ public class GroupAlreadyExistsException extends GroupException
/**
* Constructs a new instance.
*
* @param message exception message
* @param name The name (aka id) of the group
*/
public GroupAlreadyExistsException(String message) {
super(message);
public GroupAlreadyExistsException(String name) {
super(name + " group already exists");
}
}

View File

@@ -52,39 +52,7 @@ public class GroupNotFoundException extends GroupException
* Constructs a new GroupNotFoundException.
*
*/
public GroupNotFoundException() {}
/**
* 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);
public GroupNotFoundException() {
super("group does not exists");
}
}

View File

@@ -106,7 +106,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
*/
@Override
public Repository create(Repository repository)
throws RepositoryException, IOException
throws RepositoryException
{
File directory = getDirectory(repository);
@@ -135,11 +135,14 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
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,
IOException.class);
Throwables.propagateIfPossible(ex, RepositoryException.class);
return null;
}
}
@@ -172,14 +175,17 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
* @throws RepositoryException
*/
@Override
public void delete(Repository repository)
throws RepositoryException, IOException
public void delete(Repository repository) throws RepositoryException
{
File directory = getDirectory(repository);
if (directory.exists())
{
fileSystem.destroy(directory);
try {
fileSystem.destroy(directory);
} catch (IOException e) {
throw new RepositoryException("could not delete repository", e);
}
cleanupEmptyDirectories(config.getRepositoryDirectory(),
directory.getParentFile());
}
@@ -231,8 +237,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
* @throws RepositoryException
*/
@Override
public void modify(Repository repository)
throws RepositoryException, IOException
public void modify(Repository repository) throws RepositoryException
{
// nothing todo

View File

@@ -30,12 +30,10 @@ package sonia.scm.security;
import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.subject.SimplePrincipalCollection;
import sonia.scm.group.Group;
import sonia.scm.group.GroupException;
import sonia.scm.group.GroupManager;
@@ -46,9 +44,6 @@ import sonia.scm.user.UserException;
import sonia.scm.user.UserManager;
import sonia.scm.web.security.AdministrationContext;
import java.io.IOException;
import java.util.Collection;
/**
@@ -134,7 +129,7 @@ public final class SyncingRealmHelper {
groupManager.create(group);
}
}
catch (GroupException | IOException ex) {
catch (GroupException ex) {
throw new AuthenticationException("could not store group", ex);
}
});
@@ -155,7 +150,7 @@ public final class SyncingRealmHelper {
userManager.create(user);
}
}
catch (UserException | IOException ex) {
catch (UserException ex) {
throw new AuthenticationException("could not store user", ex);
}
});

View File

@@ -49,11 +49,11 @@ public class UserAlreadyExistsException extends UserException
/**
* Constructs a new instance.
*
* @param message message of exception
* @param name The name (aka id) of the user
* @since 1.5
*/
public UserAlreadyExistsException(String message)
public UserAlreadyExistsException(String name)
{
super(message);
super(name + " user already exists");
}
}

View File

@@ -51,39 +51,7 @@ public class UserNotFoundException extends UserException
* Constructs a new UserNotFoundException.
*
*/
public UserNotFoundException() {}
/**
* 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);
public UserNotFoundException() {
super("user does not exists");
}
}