Merged changes

This commit is contained in:
Philipp Czora
2018-07-06 11:59:49 +02:00
29 changed files with 292 additions and 263 deletions

View File

@@ -59,7 +59,7 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
* @throws E
* @throws IOException
*/
public void create(T object) throws E, IOException;
public void create(T object) throws E;
/**
* Removes a persistent object.
@@ -70,7 +70,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.
@@ -81,5 +81,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

@@ -35,7 +35,6 @@ package sonia.scm;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.util.Collection;
import java.util.Comparator;
@@ -78,7 +77,7 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
* {@inheritDoc}
*/
@Override
public void create(T object) throws E, IOException
public void create(T object) throws E
{
decorated.create(object);
}
@@ -87,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);
}
@@ -105,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);
}
@@ -114,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

@@ -81,7 +81,8 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
@Override
public void create(Repository repository)
throws RepositoryException, IOException {
throws RepositoryException, IOException
{
File directory = getDirectory(repository);
if (directory.exists()) {
@@ -106,7 +107,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
}
Throwables.propagateIfPossible(ex, RepositoryException.class,
IOException.class);
IOException.class);
}
}
@@ -121,7 +122,8 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
@Override
public void delete(Repository repository)
throws RepositoryException, IOException {
throws RepositoryException, IOException
{
File directory = getDirectory(repository);
if (directory.exists()) {
@@ -159,7 +161,8 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
@Override
public void modify(Repository repository)
throws RepositoryException, IOException {
throws RepositoryException, IOException
{
// nothing to do
}

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");
}
}