Replace model object exception with generic ones and migrate guice

This commit is contained in:
René Pfeuffer
2018-08-21 07:53:33 +02:00
parent bb9a0657a5
commit a0f74e3329
227 changed files with 1380 additions and 3549 deletions

38
pom.xml
View File

@@ -402,24 +402,24 @@
</executions>
</plugin>
<plugin>
<groupId>com.github.legman</groupId>
<artifactId>legman-maven-plugin</artifactId>
<version>${legman.version}</version>
<configuration>
<fail>true</fail>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<!-- Prevent usage of guava annotations that would be silently ignored -> hard to find.
We use legman annotations instead, that provide additional features such as weak references. -->
<goal>guava-migration-check</goal>
</goals>
</execution>
</executions>
</plugin>
<!--<plugin>-->
<!--<groupId>com.github.legman</groupId>-->
<!--<artifactId>legman-maven-plugin</artifactId>-->
<!--<version>${legman.version}</version>-->
<!--<configuration>-->
<!--<fail>true</fail>-->
<!--</configuration>-->
<!--<executions>-->
<!--<execution>-->
<!--<phase>process-classes</phase>-->
<!--<goals>-->
<!--&lt;!&ndash; Prevent usage of guava annotations that would be silently ignored -> hard to find.-->
<!--We use legman annotations instead, that provide additional features such as weak references. &ndash;&gt;-->
<!--<goal>guava-migration-check</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -725,7 +725,7 @@
<svnkit.version>1.8.15-scm1</svnkit.version>
<!-- util libraries -->
<guava.version>16.0.1</guava.version>
<guava.version>26.0-jre</guava.version>
<quartz.version>2.2.3</quartz.version>
<!-- build properties -->

View File

@@ -0,0 +1,4 @@
package sonia.scm;
public class AlreadyExistsException extends Exception {
}

View File

@@ -37,18 +37,15 @@ package sonia.scm;
import com.google.common.base.Objects;
import com.google.common.collect.Maps;
import sonia.scm.xml.XmlMapStringAdapter;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.Serializable;
import java.util.Map;
//~--- JDK imports ------------------------------------------------------------
/**
* Default implementation of {@link PropertiesAware} interface.

View File

@@ -0,0 +1,4 @@
package sonia.scm;
public class ConcurrentModificationException extends Exception {
}

View File

@@ -39,11 +39,8 @@ package sonia.scm;
* @author Sebastian Sdorra
*
* @param <T> a typed object
* @param <E>
*/
public interface Handler<T extends TypedObject, E extends Exception>
extends HandlerBase<T, E>
{
public interface Handler<T extends TypedObject> extends HandlerBase<T> {
/**
* Returns the type object of the handler.
@@ -51,7 +48,7 @@ public interface Handler<T extends TypedObject, E extends Exception>
*
* @return type object of the handler
*/
public Type getType();
Type getType();
/**
* Returns true if the hanlder is configured.
@@ -59,5 +56,5 @@ public interface Handler<T extends TypedObject, E extends Exception>
*
* @return true if the hanlder is configured
*/
public boolean isConfigured();
boolean isConfigured();
}

View File

@@ -44,9 +44,8 @@ import java.io.IOException;
* @author Sebastian Sdorra
*
* @param <T> type object of the handler
* @param <E> exception type of the handler
*/
public interface HandlerBase<T extends TypedObject, E extends Exception>
public interface HandlerBase<T extends TypedObject>
extends Initable, Closeable
{
@@ -55,7 +54,7 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
*
* @return The persisted object.
*/
public T create(T object) throws E;
T create(T object) throws AlreadyExistsException;
/**
* Removes a persistent object.
@@ -63,10 +62,9 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
*
* @param object to delete
*
* @throws E
* @throws IOException
*/
public void delete(T object) throws E;
void delete(T object) throws NotFoundException;
/**
* Modifies a persistent object.
@@ -74,8 +72,7 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
*
* @param object to modify
*
* @throws E
* @throws IOException
*/
public void modify(T object) throws E;
void modify(T object) throws NotFoundException;
}

View File

@@ -42,10 +42,9 @@ import java.util.Comparator;
* @author Sebastian Sdorra
*
* @param <T> type of the model object
* @param <E> type of the exception
*/
public interface Manager<T extends ModelObject, E extends Exception>
extends HandlerBase<T, E>, LastModifiedAware
public interface Manager<T extends ModelObject>
extends HandlerBase<T>, LastModifiedAware
{
/**
@@ -54,9 +53,9 @@ public interface Manager<T extends ModelObject, E extends Exception>
*
* @param object to refresh
*
* @throws E
* @throws NotFoundException
*/
void refresh(T object) throws E;
void refresh(T object) throws NotFoundException;
//~--- get methods ----------------------------------------------------------

View File

@@ -45,11 +45,8 @@ import java.util.Comparator;
* @since 1.23
*
* @param <T> model type
* @param <E> exception type
*/
public class ManagerDecorator<T extends ModelObject, E extends Exception>
implements Manager<T, E>
{
public class ManagerDecorator<T extends ModelObject> implements Manager<T> {
/**
* Constructs a new ManagerDecorator.
@@ -57,125 +54,78 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
*
* @param decorated manager implementation
*/
public ManagerDecorator(Manager<T, E> decorated)
public ManagerDecorator(Manager<T> decorated)
{
this.decorated = decorated;
}
//~--- methods --------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public void close() throws IOException
{
decorated.close();
}
/**
* {@inheritDoc}
*/
@Override
public T create(T object) throws E
{
public T create(T object) throws AlreadyExistsException {
return decorated.create(object);
}
/**
* {@inheritDoc}
*/
@Override
public void delete(T object) throws E
{
public void delete(T object) throws NotFoundException {
decorated.delete(object);
}
/**
* {@inheritDoc}
*/
@Override
public void init(SCMContextProvider context)
{
decorated.init(context);
}
/**
* {@inheritDoc}
*/
@Override
public void modify(T object) throws E
{
public void modify(T object) throws NotFoundException {
decorated.modify(object);
}
/**
* {@inheritDoc}
*/
@Override
public void refresh(T object) throws E
{
public void refresh(T object) throws NotFoundException {
decorated.refresh(object);
}
//~--- get methods ----------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public T get(String id)
{
return decorated.get(id);
}
/**
* {@inheritDoc}
*/
@Override
public Collection<T> getAll()
{
return decorated.getAll();
}
/**
* {@inheritDoc}
*/
@Override
public Collection<T> getAll(Comparator<T> comparator)
{
return decorated.getAll(comparator);
}
/**
* {@inheritDoc}
*/
@Override
public Collection<T> getAll(int start, int limit)
{
return decorated.getAll(start, limit);
}
/**
* {@inheritDoc}
*/
@Override
public Collection<T> getAll(Comparator<T> comparator, int start, int limit)
{
return decorated.getAll(comparator, start, limit);
}
/**
* {@inheritDoc}
*/
@Override
public Long getLastModified()
{
return decorated.getLastModified();
}
//~--- fields ---------------------------------------------------------------
/** manager implementation */
private Manager<T, E> decorated;
private Manager<T> decorated;
}

View File

@@ -0,0 +1,10 @@
package sonia.scm;
public class NotFoundException extends Exception {
public NotFoundException(String type, String id) {
super(type + " with id '" + id + "' not found");
}
public NotFoundException() {
}
}

View File

@@ -44,10 +44,8 @@ import java.util.Collection;
*
* @param <T> type of the model object
* @param <H> type of the handler
* @param <E> type of the exception
*/
public interface TypeManager<T extends ModelObject, H extends Handler<T, E>,
E extends Exception> extends Manager<T, E>
public interface TypeManager<T extends ModelObject, H extends Handler<T>> extends Manager<T>
{
/**
@@ -58,7 +56,7 @@ public interface TypeManager<T extends ModelObject, H extends Handler<T, E>,
*
* @return the handler for given type
*/
public H getHandler(String type);
H getHandler(String type);
/**
* Returns a {@link java.util.Collection} of all
@@ -66,5 +64,5 @@ public interface TypeManager<T extends ModelObject, H extends Handler<T, E>,
*
* @return all available types
*/
public Collection<Type> getTypes();
Collection<Type> getTypes();
}

View File

@@ -33,6 +33,7 @@ package sonia.scm.cache;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
/**
@@ -101,7 +102,7 @@ public final class CacheStatistics
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("name", name)
.add("hitCount", hitCount)
.add("missCount", missCount)

View File

@@ -33,8 +33,8 @@ package sonia.scm.event;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import sonia.scm.HandlerEventType;
/**
@@ -127,7 +127,7 @@ public class AbstractHandlerEvent<T> implements HandlerEvent<T>
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("eventType", eventType)
.add("item", item)
.add("oldItem", oldItem)

View File

@@ -37,6 +37,7 @@ package sonia.scm.group;
import com.github.sdorra.ssp.PermissionObject;
import com.github.sdorra.ssp.StaticPermissions;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import sonia.scm.BasicPropertiesAware;
@@ -259,7 +260,7 @@ public class Group extends BasicPropertiesAware
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("name", name)
.add("description", description)
.add("members", members)

View File

@@ -1,50 +0,0 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.group;
/**
* This {@link Exception} is thrown when trying to create a group
* that already exists.
*
* @author Sebastian Sdorra
*/
public class GroupAlreadyExistsException extends GroupException
{
private static final long serialVersionUID = 4042878550219750430L;
public GroupAlreadyExistsException(Group group) {
super(group.getName() + " group already exists");
}
}

View File

@@ -1,91 +0,0 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.group;
/**
* General {@link Exception} for group errors.
*
* @author Sebastian Sdorra
*/
public class GroupException extends Exception
{
/** Field description */
private static final long serialVersionUID = 5191341492098994225L;
//~--- constructors ---------------------------------------------------------
/**
* Constructs a {@link GroupException} object.
*
*/
public GroupException()
{
super();
}
/**
* Constructs a {@link GroupException} object.
*
*
* @param message for the exception
*/
public GroupException(String message)
{
super(message);
}
/**
* Constructs a {@link GroupException} object.
*
*
* @param cause of the exception
*/
public GroupException(Throwable cause)
{
super(cause);
}
/**
* Constructs a {@link GroupException} object.
*
*
* @param message of the exception
* @param cause of the exception
*/
public GroupException(String message, Throwable cause)
{
super(message, cause);
}
}

View File

@@ -38,10 +38,10 @@ package sonia.scm.group;
import sonia.scm.Manager;
import sonia.scm.search.Searchable;
//~--- JDK imports ------------------------------------------------------------
import java.util.Collection;
//~--- JDK imports ------------------------------------------------------------
/**
* The central class for managing {@link Group}s.
* This class is a singleton and is available via injection.
@@ -49,7 +49,7 @@ import java.util.Collection;
* @author Sebastian Sdorra
*/
public interface GroupManager
extends Manager<Group, GroupException>, Searchable<Group>
extends Manager<Group>, Searchable<Group>
{
/**

View File

@@ -38,10 +38,10 @@ package sonia.scm.group;
import sonia.scm.ManagerDecorator;
import sonia.scm.search.SearchRequest;
//~--- JDK imports ------------------------------------------------------------
import java.util.Collection;
//~--- JDK imports ------------------------------------------------------------
/**
* Decorator for {@link GroupManager}.
*
@@ -49,7 +49,7 @@ import java.util.Collection;
* @since 1.23
*/
public class GroupManagerDecorator
extends ManagerDecorator<Group, GroupException> implements GroupManager
extends ManagerDecorator<Group> implements GroupManager
{
/**

View File

@@ -39,14 +39,13 @@ import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
//~--- JDK imports ------------------------------------------------------------
/**
* This class represents all associated groups for a user.
*

View File

@@ -1,58 +0,0 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.group;
/**
* The GroupNotFoundException is thrown e.g. from the
* modify method of the {@link GroupManager}, if the group does not exists.
*
* @author Sebastian Sdorra
*
* @since 1.28
*/
public class GroupNotFoundException extends GroupException
{
/** Field description */
private static final long serialVersionUID = -1617037899954718001L;
//~--- constructors ---------------------------------------------------------
/**
* Constructs a new GroupNotFoundException.
*
*/
public GroupNotFoundException(Group group) {
super("group " + group.getName() + " does not exist");
}
}

View File

@@ -36,16 +36,13 @@ package sonia.scm.i18n;
import com.google.common.base.Objects;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import sonia.scm.util.ClassLoaders;
//~--- JDK imports ------------------------------------------------------------
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
//~--- JDK imports ------------------------------------------------------------
/**
* The I18nMessages class instantiates a class and initializes all {@link String}

View File

@@ -33,12 +33,13 @@ package sonia.scm.plugin;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import javax.xml.bind.annotation.XmlElement;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -117,7 +118,7 @@ public final class ClassElement
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("clazz", clazz)
.add("description", description)
.toString();

View File

@@ -33,15 +33,16 @@ package sonia.scm.plugin;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -129,7 +130,7 @@ public final class ExtensionPointElement
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("class", clazz)
.add("description", description)
.add("multiple", multiple)

View File

@@ -35,18 +35,18 @@ package sonia.scm.plugin;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
//~--- JDK imports ------------------------------------------------------------
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Set;
//~--- JDK imports ------------------------------------------------------------
/**
*
@@ -142,7 +142,7 @@ public final class Plugin extends ScmModule
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("scmVersion", scmVersion)
.add("condition", condition)
.add("information", information)

View File

@@ -35,27 +35,25 @@ package sonia.scm.plugin;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import sonia.scm.PlatformType;
import sonia.scm.SCMContext;
import sonia.scm.util.SystemUtil;
import sonia.scm.util.Util;
import sonia.scm.version.Version;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
//~--- JDK imports ------------------------------------------------------------
/**
*
@@ -164,7 +162,7 @@ public class PluginCondition implements Cloneable, Serializable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("arch", arch)
.add("minVersion", minVersion)
.add("os", os)

View File

@@ -37,24 +37,21 @@ package sonia.scm.plugin;
import com.github.sdorra.ssp.PermissionObject;
import com.github.sdorra.ssp.StaticPermissions;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import sonia.scm.Validateable;
import sonia.scm.util.Util;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
*
@@ -180,7 +177,7 @@ public class PluginInformation
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("artifactId", artifactId)
.add("author", author)
.add("category", category)

View File

@@ -35,12 +35,13 @@ package sonia.scm.plugin;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -121,7 +122,7 @@ public class PluginRepository implements Serializable
@Override
public String toString()
{
return Objects.toStringHelper(this).add("id", id).add("url",
return MoreObjects.toStringHelper(this).add("id", id).add("url",
url).toString();
}

View File

@@ -35,15 +35,15 @@ package sonia.scm.plugin;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import java.util.Set;
//~--- JDK imports ------------------------------------------------------------
/**
*
@@ -124,7 +124,7 @@ public class PluginResources
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("scriptResources", scriptResources)
.add("stylesheetResources", stylesheetResources)
.toString();

View File

@@ -33,15 +33,16 @@ package sonia.scm.plugin;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -126,7 +127,7 @@ public final class SubscriberElement
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("eventClass", eventClass)
.add("subscriberClass", subscriberClass)
.add("description", description)

View File

@@ -35,9 +35,9 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Throwables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.AlreadyExistsException;
import sonia.scm.repository.ImportResult.Builder;
import java.io.File;
@@ -86,9 +86,7 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
* {@inheritDoc}
*/
@Override
public List<String> importRepositories(RepositoryManager manager)
throws IOException, RepositoryException
{
public List<String> importRepositories(RepositoryManager manager) throws IOException {
return doRepositoryImport(manager, true).getImportedDirectories();
}
@@ -97,24 +95,9 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
*/
@Override
public ImportResult importRepositoriesFromDirectory(RepositoryManager manager)
{
try
{
return doRepositoryImport(manager, false);
}
catch (IOException ex)
{
// should never happen
throw Throwables.propagate(ex);
}
catch (RepositoryException ex)
{
// should never happen
throw Throwables.propagate(ex);
}
}
/**
* Creates a repository.
@@ -126,12 +109,8 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
* @return repository
*
* @throws IOException
* @throws RepositoryException
*/
protected Repository createRepository(File repositoryDirectory,
String repositoryName)
throws IOException, RepositoryException
{
protected Repository createRepository(File repositoryDirectory, String repositoryName) throws IOException {
Repository repository = new Repository();
repository.setName(repositoryName);
@@ -151,12 +130,8 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
* @return import result
*
* @throws IOException
* @throws RepositoryException
*/
private ImportResult doRepositoryImport(RepositoryManager manager,
boolean throwExceptions)
throws IOException, RepositoryException
{
private ImportResult doRepositoryImport(RepositoryManager manager, boolean throwExceptions) {
Builder builder = ImportResult.builder();
logger.trace("search for repositories to import");
@@ -215,11 +190,10 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
* @param directoryName
*
* @throws IOException
* @throws RepositoryException
*/
private void importRepository(RepositoryManager manager, Builder builder,
boolean throwExceptions, String directoryName)
throws IOException, RepositoryException
throws IOException
{
logger.trace("check repository {} for import", directoryName);
@@ -266,12 +240,10 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
*
* @return
* @throws IOException
* @throws RepositoryException
*/
private void importRepository(RepositoryManager manager,
String repositoryName)
throws IOException, RepositoryException
{
throws IOException, AlreadyExistsException {
Repository repository =
createRepository(getRepositoryDirectory(repositoryName), repositoryName);

View File

@@ -38,6 +38,7 @@ import com.google.common.base.Throwables;
import com.google.common.io.Resources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.AlreadyExistsException;
import sonia.scm.ConfigurationException;
import sonia.scm.io.CommandResult;
import sonia.scm.io.ExtendedCommand;
@@ -80,12 +81,11 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
}
@Override
public Repository create(Repository repository)
throws RepositoryException {
public Repository create(Repository repository) throws AlreadyExistsException {
File directory = getDirectory(repository);
if (directory.exists()) {
throw RepositoryAlreadyExistsException.create(repository);
throw new AlreadyExistsException();
}
checkPath(directory);
@@ -105,7 +105,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
}
}
Throwables.propagateIfPossible(ex, RepositoryException.class);
Throwables.propagateIfPossible(ex, AlreadyExistsException.class);
// This point will never be reached
return null;
}
@@ -121,15 +121,14 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
}
@Override
public void delete(Repository repository)
throws RepositoryException {
public void delete(Repository repository) {
File directory = getDirectory(repository);
if (directory.exists()) {
try {
fileSystem.destroy(directory);
} catch (IOException e) {
throw new RepositoryException("could not delete repository", e);
throw new InternalRepositoryException("could not delete repository directory", e);
}
cleanupEmptyDirectories(config.getRepositoryDirectory(),
directory.getParentFile());
@@ -202,17 +201,12 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
}
protected void create(Repository repository, File directory)
throws RepositoryException, IOException {
throws IOException, AlreadyExistsException {
ExtendedCommand cmd = buildCreateCommand(repository, directory);
CommandResult result = cmd.execute();
if (!result.isSuccessfull()) {
StringBuilder msg = new StringBuilder("command exit with error ");
msg.append(result.getReturnCode()).append(" and message: '");
msg.append(result.getOutput()).append("'");
throw new RepositoryException(msg.toString());
throw new IOException(("command exit with error " + result.getReturnCode() + " and message: '" + result.getOutput() + "'"));
}
}
@@ -221,7 +215,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
}
protected void postCreate(Repository repository, File directory)
throws IOException, RepositoryException {
throws IOException {
}
/**
@@ -262,9 +256,9 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
* Check path for existing repositories
*
* @param directory repository target directory
* @throws RepositoryAlreadyExistsException
* @throws AlreadyExistsException
*/
private void checkPath(File directory) throws RepositoryAlreadyExistsException {
private void checkPath(File directory) throws AlreadyExistsException {
File repositoryDirectory = config.getRepositoryDirectory();
File parent = directory.getParentFile();
@@ -274,9 +268,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
if (isRepository(parent)) {
logger.error("parent path {} is a repository", parent);
StringBuilder buffer = new StringBuilder("repository with name ");
buffer.append(directory.getName()).append(" already exists");
throw new RepositoryAlreadyExistsException(buffer.toString());
throw new AlreadyExistsException();
}
parent = parent.getParentFile();

View File

@@ -35,12 +35,13 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* Single line of a file, in a {@link BlameResult}.
*
@@ -140,7 +141,7 @@ public class BlameLine implements Serializable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("lineNumber", lineNumber)
.add("revision", revision)
.add("author", author)

View File

@@ -35,21 +35,20 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
* Changeset information by line for a given file.
@@ -163,7 +162,7 @@ public class BlameResult implements Serializable, Iterable<BlameLine>
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("total", total)
.add("blameLines", blameLines)
.toString();

View File

@@ -35,15 +35,15 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* Represents a branch in a repository.
@@ -132,7 +132,7 @@ public final class Branch implements Serializable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("name", name)
.add("revision", revision)
.toString();

View File

@@ -0,0 +1,9 @@
package sonia.scm.repository;
import sonia.scm.NotFoundException;
public class BranchNotFoundException extends NotFoundException {
public BranchNotFoundException(String branch) {
super("branch", branch);
}
}

View File

@@ -34,17 +34,18 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
//~--- JDK imports ------------------------------------------------------------
import java.util.Iterator;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Iterator;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
* Represents all branches of a repository.
@@ -148,7 +149,7 @@ public final class Branches implements Iterable<Branch>
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("branches", branches)
.toString();
//J+

View File

@@ -35,20 +35,19 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
*
@@ -161,7 +160,7 @@ public class BrowserResult implements Iterable<FileObject>, Serializable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("revision", revision)
.add("tag", tag)
.add("branch", branch)

View File

@@ -36,24 +36,21 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects;
import sonia.scm.BasicPropertiesAware;
import sonia.scm.Validateable;
import sonia.scm.util.Util;
import sonia.scm.util.ValidationUtil;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
* Represents a changeset/commit of a repository.

View File

@@ -35,20 +35,19 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
* The changeset paging result is used to do a paging over the
@@ -156,7 +155,7 @@ public class ChangesetPagingResult implements Iterable<Changeset>, Serializable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("changesets", changesets)
.add("total", total)
.toString();

View File

@@ -35,18 +35,17 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import sonia.scm.LastModifiedAware;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* The FileObject represents a file or a directory in a repository.
@@ -110,7 +109,7 @@ public class FileObject implements LastModifiedAware, Serializable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("name", name)
.add("path", path)
.add("directory", directory)

View File

@@ -33,14 +33,15 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
//~--- JDK imports ------------------------------------------------------------
/**
* Single failure of a {@link HealthCheck}.
*
@@ -132,7 +133,7 @@ public final class HealthCheckFailure
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("summary", summary)
.add("url", url)

View File

@@ -33,13 +33,14 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
//~--- JDK imports ------------------------------------------------------------
import java.util.Set;
//~--- JDK imports ------------------------------------------------------------
/**
* Result of {@link HealthCheck}.
*
@@ -182,7 +183,7 @@ public final class HealthCheckResult
@Override
public String toString()
{
return Objects.toStringHelper(this).add("failures", failures).toString();
return MoreObjects.toStringHelper(this).add("failures", failures).toString();
}
//~--- get methods ----------------------------------------------------------

View File

@@ -35,7 +35,6 @@ package sonia.scm.repository;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.util.List;
/**
@@ -56,8 +55,6 @@ public interface ImportHandler
*
* @return a {@link List} names of imported repositories
* @throws IOException
* @throws RepositoryException
*/
public List<String> importRepositories(RepositoryManager manager)
throws IOException, RepositoryException;
public List<String> importRepositories(RepositoryManager manager) throws IOException;
}

View File

@@ -33,18 +33,19 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import static com.google.common.base.Preconditions.*;
//~--- JDK imports ------------------------------------------------------------
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
//~--- JDK imports ------------------------------------------------------------
/**
* Import result of the {@link AdvancedImportHandler}.
@@ -130,7 +131,7 @@ public final class ImportResult
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("importedDirectories", importedDirectories)
.add("failedDirectories", failedDirectories)
.toString();

View File

@@ -0,0 +1,15 @@
package sonia.scm.repository;
public class InternalRepositoryException extends RuntimeException {
public InternalRepositoryException(Throwable ex) {
super(ex);
}
public InternalRepositoryException(String msg, Exception ex) {
super(msg, ex);
}
public InternalRepositoryException(String message) {
super(message);
}
}

View File

@@ -37,20 +37,17 @@ package sonia.scm.repository;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import sonia.scm.util.Util;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
*

View File

@@ -35,6 +35,7 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.NotFoundException;
import sonia.scm.util.Util;
/**
@@ -42,7 +43,7 @@ import sonia.scm.util.Util;
*
* @author Sebastian Sdorra
*/
public class PathNotFoundException extends RepositoryException
public class PathNotFoundException extends NotFoundException
{
/** Field description */
@@ -59,7 +60,7 @@ public class PathNotFoundException extends RepositoryException
*/
public PathNotFoundException(String path)
{
super("path \"".concat(Util.nonNull(path)).concat("\" not found"));
super("path", Util.nonNull(path));
this.path = Util.nonNull(path);
}

View File

@@ -35,17 +35,16 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import sonia.scm.security.PermissionObject;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* Permissions controls the access to {@link Repository}.
@@ -163,7 +162,7 @@ public class Permission implements PermissionObject, Serializable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("name", name)
.add("type", type)
.add("groupPermission", groupPermission)

View File

@@ -36,18 +36,16 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects;
import sonia.scm.Validateable;
import sonia.scm.util.Util;
import sonia.scm.util.ValidationUtil;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* The {@link Person} (author) of a changeset.

View File

@@ -35,6 +35,7 @@ package sonia.scm.repository;
import com.github.sdorra.ssp.PermissionObject;
import com.github.sdorra.ssp.StaticPermissions;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import sonia.scm.BasicPropertiesAware;
@@ -401,7 +402,7 @@ public class Repository extends BasicPropertiesAware implements ModelObject, Per
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("namespace", namespace)
.add("name", name)

View File

@@ -1,68 +0,0 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.repository;
/**
* This {@link Exception} is thrown when trying to create a repository with
* the same name and type already exists.
*
* @author Sebastian Sdorra
*/
public class RepositoryAlreadyExistsException extends RepositoryException
{
private static final long serialVersionUID = -774929917214137675L;
/**
* Creates a new instance.
*
* @param message exception message
*/
public RepositoryAlreadyExistsException(String message) {
super(message);
}
/**
* Creates a new {@link RepositoryAlreadyExistsException} with an appropriate message.
*
* @param repository repository that already exists
*
* @return new exception with appropriate message
*/
public static RepositoryAlreadyExistsException create(Repository repository){
StringBuilder buffer = new StringBuilder("repository with name ");
buffer.append(repository.getName()).append(" of type ");
buffer.append(repository.getType()).append("already exists");
return new RepositoryAlreadyExistsException(buffer.toString());
}
}

View File

@@ -1,95 +0,0 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.repository;
/**
* Base class for all repository exceptions.
*
* @author Sebastian Sdorra
*/
public class RepositoryException extends Exception
{
/** Field description */
private static final long serialVersionUID = -4939196278070910058L;
//~--- constructors ---------------------------------------------------------
/**
* Constructs a new {@link RepositoryException} with null as its
* error detail message.
*
*/
public RepositoryException()
{
super();
}
/**
* Constructs a new {@link RepositoryException} with the specified
* detail message.
*
*
* @param message detail message
*/
public RepositoryException(String message)
{
super(message);
}
/**
* Constructs a new {@link RepositoryException} with the specified
* detail message and cause.
*
*
* @param cause the cause for the exception
*/
public RepositoryException(Throwable cause)
{
super(cause);
}
/**
* Constructs a new {@link RepositoryException} with the specified
* detail message and cause.
*
*
* @param message detail message
* @param cause the cause for the exception
*/
public RepositoryException(String message, Throwable cause)
{
super(message, cause);
}
}

View File

@@ -47,7 +47,7 @@ import sonia.scm.plugin.ExtensionPoint;
*/
@ExtensionPoint
public interface RepositoryHandler
extends Handler<Repository, RepositoryException>
extends Handler<Repository>
{
/**

View File

@@ -1,64 +0,0 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.repository;
/**
*
* @author Sebastian Sdorra
*/
public class RepositoryHandlerNotFoundException extends RepositoryException
{
/** Field description */
private static final long serialVersionUID = 5270463060802850944L;
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
*
*/
public RepositoryHandlerNotFoundException() {}
/**
* Constructs ...
*
*
* @param message
*/
public RepositoryHandlerNotFoundException(String message)
{
super(message);
}
}

View File

@@ -38,7 +38,7 @@ package sonia.scm.repository;
*
* @since 1.14
*/
public class RepositoryIsNotArchivedException extends RepositoryException {
public class RepositoryIsNotArchivedException extends RuntimeException {
private static final long serialVersionUID = 7728748133123987511L;

View File

@@ -35,6 +35,7 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.AlreadyExistsException;
import sonia.scm.TypeManager;
import javax.servlet.http.HttpServletRequest;
@@ -52,7 +53,7 @@ import java.util.Collection;
* @apiviz.uses sonia.scm.repository.RepositoryHandler
*/
public interface RepositoryManager
extends TypeManager<Repository, RepositoryHandler, RepositoryException>
extends TypeManager<Repository, RepositoryHandler>
{
/**
@@ -72,10 +73,8 @@ public interface RepositoryManager
* @param repository {@link Repository} to import
*
* @throws IOException
* @throws RepositoryException
*/
public void importRepository(Repository repository)
throws IOException, RepositoryException;
public void importRepository(Repository repository) throws IOException, AlreadyExistsException;
//~--- get methods ----------------------------------------------------------

View File

@@ -35,6 +35,7 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.AlreadyExistsException;
import sonia.scm.ManagerDecorator;
import sonia.scm.Type;
@@ -51,7 +52,7 @@ import java.util.Collection;
* @since 1.23
*/
public class RepositoryManagerDecorator
extends ManagerDecorator<Repository, RepositoryException>
extends ManagerDecorator<Repository>
implements RepositoryManager
{
@@ -82,9 +83,7 @@ public class RepositoryManagerDecorator
* {@inheritDoc}
*/
@Override
public void importRepository(Repository repository)
throws IOException, RepositoryException
{
public void importRepository(Repository repository) throws IOException, AlreadyExistsException {
decorated.importRepository(repository);
}

View File

@@ -33,13 +33,15 @@
package sonia.scm.repository;
import sonia.scm.NotFoundException;
/**
* Signals that the specified {@link Repository} could be found.
*
* @author Sebastian Sdorra
* @since 1.6
*/
public class RepositoryNotFoundException extends RepositoryException
public class RepositoryNotFoundException extends NotFoundException
{
/** Field description */
@@ -53,10 +55,10 @@ public class RepositoryNotFoundException extends RepositoryException
*
*/
public RepositoryNotFoundException(Repository repository) {
super("repository " + repository.getName() + "/" + repository.getNamespace() + " does not exist");
super("repository", repository.getName() + "/" + repository.getNamespace());
}
public RepositoryNotFoundException(String repositoryId) {
super("repository with id " + repositoryId + " does not exist");
super("repository", repositoryId);
}
}

View File

@@ -37,12 +37,11 @@ package sonia.scm.repository;
import sonia.scm.plugin.ExtensionPoint;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
* Listener before a repository request is executed. Repository request are
@@ -68,10 +67,6 @@ public interface RepositoryRequestListener
*
* @return false to abort the request
* @throws IOException
* @throws RepositoryException
*/
public boolean handleRequest(HttpServletRequest request,
HttpServletResponse response,
Repository repository)
throws IOException, RepositoryException;
boolean handleRequest(HttpServletRequest request, HttpServletResponse response, Repository repository) throws IOException;
}

View File

@@ -35,6 +35,7 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.NotFoundException;
import sonia.scm.util.Util;
/**
@@ -42,8 +43,7 @@ import sonia.scm.util.Util;
*
* @author Sebastian Sdorra
*/
public class RevisionNotFoundException extends RepositoryException
{
public class RevisionNotFoundException extends NotFoundException {
/** Field description */
private static final long serialVersionUID = -5594008535358811998L;
@@ -59,7 +59,7 @@ public class RevisionNotFoundException extends RepositoryException
*/
public RevisionNotFoundException(String revision)
{
super("revision \"".concat(Util.nonNull(revision)).concat("\" not found"));
super("revision", revision);
this.revision = Util.nonNull(revision);
}

View File

@@ -35,16 +35,16 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* @since 1.10
@@ -157,7 +157,7 @@ public class SubRepository implements Serializable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("repositoryUrl", repositoryUrl)
.add("browserUrl", browserUrl)
.add("revision", revision)

View File

@@ -34,14 +34,15 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
//~--- JDK imports ------------------------------------------------------------
/**
* Represents a tag in a repository.
*
@@ -124,7 +125,7 @@ public final class Tag
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("name", name)
.add("revision", revision)
.toString();

View File

@@ -34,18 +34,18 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
//~--- JDK imports ------------------------------------------------------------
import java.util.Iterator;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Iterator;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
* Represents all tags of a repository.
@@ -138,7 +138,7 @@ public final class Tags implements Iterable<Tag>
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("tags", tags)
.toString();
//J+

View File

@@ -33,8 +33,8 @@ package sonia.scm.repository.api;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
/**
* Abstract class for bundle or unbundle command.
*
@@ -95,7 +95,7 @@ public abstract class AbstractBundleOrUnbundleCommandResponse
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("changesetCount", changesetCount)
.toString();
//J+

View File

@@ -38,25 +38,22 @@ package sonia.scm.repository.api;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.cache.Cache;
import sonia.scm.cache.CacheManager;
import sonia.scm.repository.BlameResult;
import sonia.scm.repository.PreProcessorUtil;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryCacheKey;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.spi.BlameCommand;
import sonia.scm.repository.spi.BlameCommandRequest;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* Shows changeset information by line for a given file.
* Blame is also known as annotate in some SCM systems.<br />
@@ -138,10 +135,9 @@ public final class BlameCommandBuilder
* @throws IllegalArgumentException if the path is null or empty
*
* @throws IOException
* @throws RepositoryException
*/
public BlameResult getBlameResult(String path)
throws IOException, RepositoryException
throws IOException
{
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
"path is required");

View File

@@ -40,8 +40,6 @@ import sonia.scm.repository.Branch;
import sonia.scm.repository.Branches;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryCacheKey;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.spi.BlameCommand;
import sonia.scm.repository.spi.BranchesCommand;
import java.io.IOException;
@@ -80,10 +78,8 @@ public final class BranchesCommandBuilder
* only be called from the {@link RepositoryService}.
*
* @param cacheManager cache manager
* @param blameCommand implementation of the {@link BlameCommand}
* @param branchesCommand
* @param branchesCommand implementation of the {@link BranchesCommand}
* @param repository repository to query
* @param preProcessorUtil
*/
BranchesCommandBuilder(CacheManager cacheManager,
BranchesCommand branchesCommand, Repository repository)
@@ -102,9 +98,8 @@ public final class BranchesCommandBuilder
* @return branches from the repository
*
* @throws IOException
* @throws RepositoryException
*/
public Branches getBranches() throws RepositoryException, IOException
public Branches getBranches() throws IOException
{
Branches branches;
@@ -173,10 +168,9 @@ public final class BranchesCommandBuilder
* @return
*
* @throws IOException
* @throws RepositoryException
*/
private Branches getBranchesFromCommand()
throws RepositoryException, IOException
throws IOException
{
return new Branches(branchesCommand.getBranches());
}

View File

@@ -36,10 +36,8 @@ package sonia.scm.repository.api;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.cache.Cache;
import sonia.scm.cache.CacheManager;
import sonia.scm.repository.BrowserResult;
@@ -48,18 +46,17 @@ import sonia.scm.repository.FileObjectNameComparator;
import sonia.scm.repository.PreProcessorUtil;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryCacheKey;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.RevisionNotFoundException;
import sonia.scm.repository.spi.BrowseCommand;
import sonia.scm.repository.spi.BrowseCommandRequest;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
* BrowseCommandBuilder is able to browse the files of a {@link Repository}.
* <br /><br />
@@ -100,7 +97,7 @@ public final class BrowseCommandBuilder
* only be called from the {@link RepositoryService}.
*
* @param cacheManager cache manager
* @param logCommand implementation of the {@link LogCommand}
* @param browseCommand implementation of the {@link BrowseCommand}
* @param browseCommand
* @param repository repository to query
* @param preProcessorUtil
@@ -140,11 +137,8 @@ public final class BrowseCommandBuilder
* @return files for the given parameters
*
* @throws IOException
* @throws RepositoryException
*/
public BrowserResult getBrowserResult()
throws IOException, RepositoryException
{
public BrowserResult getBrowserResult() throws IOException, RevisionNotFoundException {
BrowserResult result = null;
if (disableCache)

View File

@@ -37,23 +37,21 @@ package sonia.scm.repository.api;
import com.google.common.io.ByteSink;
import com.google.common.io.Files;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.spi.BundleCommand;
import sonia.scm.repository.spi.BundleCommandRequest;
import static com.google.common.base.Preconditions.*;
//~--- JDK imports ------------------------------------------------------------
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
//~--- JDK imports ------------------------------------------------------------
/**
* The bundle command dumps a repository to a byte source such as a file. The
* created bundle can be restored to an empty repository with the
@@ -94,11 +92,8 @@ public final class BundleCommandBuilder
* @return bundle response
*
* @throws IOException
* @throws RepositoryException
*/
public BundleResponse bundle(File outputFile)
throws IOException, RepositoryException
{
public BundleResponse bundle(File outputFile) throws IOException {
checkArgument((outputFile != null) &&!outputFile.exists(),
"file is null or exists already");
@@ -120,10 +115,9 @@ public final class BundleCommandBuilder
* @return bundle response
*
* @throws IOException
* @throws RepositoryException
*/
public BundleResponse bundle(OutputStream outputStream)
throws IOException, RepositoryException
throws IOException
{
checkNotNull(outputStream, "output stream is required");
@@ -141,10 +135,9 @@ public final class BundleCommandBuilder
* @return bundle response
*
* @throws IOException
* @throws RepositoryException
*/
public BundleResponse bundle(ByteSink sink)
throws IOException, RepositoryException
throws IOException
{
checkNotNull(sink, "byte sink is required");
logger.info("bundle {} to byte sink");

View File

@@ -37,8 +37,9 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.PathNotFoundException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.RevisionNotFoundException;
import sonia.scm.repository.spi.CatCommand;
import sonia.scm.repository.spi.CatCommandRequest;
import sonia.scm.util.IOUtil;
@@ -106,7 +107,7 @@ public final class CatCommandBuilder
* @param outputStream output stream for the content
* @param path file path
*/
public void retriveContent(OutputStream outputStream, String path) throws IOException, RepositoryException {
public void retriveContent(OutputStream outputStream, String path) throws IOException, PathNotFoundException, RevisionNotFoundException {
getCatResult(outputStream, path);
}
@@ -115,7 +116,7 @@ public final class CatCommandBuilder
*
* @param path file path
*/
public InputStream getStream(String path) throws IOException, RepositoryException {
public InputStream getStream(String path) throws IOException, PathNotFoundException, RevisionNotFoundException {
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
"path is required");
@@ -137,10 +138,8 @@ public final class CatCommandBuilder
* @return content of the file
*
* @throws IOException
* @throws RepositoryException
*/
public String getContent(String path) throws IOException, RepositoryException
{
public String getContent(String path) throws IOException, PathNotFoundException, RevisionNotFoundException {
String content = null;
ByteArrayOutputStream baos = null;
@@ -185,11 +184,9 @@ public final class CatCommandBuilder
* @param path path of the file
*
* @throws IOException
* @throws RepositoryException
*/
private void getCatResult(OutputStream outputStream, String path)
throws IOException, RepositoryException
{
throws IOException, PathNotFoundException, RevisionNotFoundException {
Preconditions.checkNotNull(outputStream, "OutputStream is required");
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
"path is required");

View File

@@ -36,21 +36,19 @@ package sonia.scm.repository.api;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Preconditions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.RevisionNotFoundException;
import sonia.scm.repository.spi.DiffCommand;
import sonia.scm.repository.spi.DiffCommandRequest;
import sonia.scm.util.IOUtil;
//~--- JDK imports ------------------------------------------------------------
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
//~--- JDK imports ------------------------------------------------------------
/**
* Shows differences between revisions for a specified file or
* the entire revision.<br />
@@ -87,9 +85,7 @@ public final class DiffCommandBuilder
* Constructs a new {@link DiffCommandBuilder}, this constructor should
* only be called from the {@link RepositoryService}.
*
* @param implementation of {@link DiffCommand}
*
* @param diffCommand
* @param diffCommand implementation of {@link DiffCommand}
*/
DiffCommandBuilder(DiffCommand diffCommand)
{
@@ -107,11 +103,8 @@ public final class DiffCommandBuilder
* @return {@code this}
*
* @throws IOException
* @throws RepositoryException
*/
public DiffCommandBuilder retriveContent(OutputStream outputStream)
throws IOException, RepositoryException
{
public DiffCommandBuilder retriveContent(OutputStream outputStream) throws IOException, RevisionNotFoundException {
getDiffResult(outputStream);
return this;
@@ -125,10 +118,8 @@ public final class DiffCommandBuilder
* @return content of the difference
*
* @throws IOException
* @throws RepositoryException
*/
public String getContent() throws IOException, RepositoryException
{
public String getContent() throws IOException, RevisionNotFoundException {
String content = null;
ByteArrayOutputStream baos = null;
@@ -205,14 +196,10 @@ public final class DiffCommandBuilder
*
*
* @param outputStream
* @param path
*
* @throws IOException
* @throws RepositoryException
*/
private void getDiffResult(OutputStream outputStream)
throws IOException, RepositoryException
{
private void getDiffResult(OutputStream outputStream) throws IOException, RevisionNotFoundException {
Preconditions.checkNotNull(outputStream, "OutputStream is required");
Preconditions.checkArgument(request.isValid(),
"path and/or revision is required");

View File

@@ -36,22 +36,20 @@ package sonia.scm.repository.api;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import sonia.scm.cache.CacheManager;
import sonia.scm.repository.Changeset;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.PermissionType;
import sonia.scm.repository.PreProcessorUtil;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.spi.IncomingCommand;
import sonia.scm.repository.spi.IncomingCommandRequest;
import sonia.scm.security.RepositoryPermission;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
* The incoming command shows new {@link Changeset}s found in a different
* repository location.
@@ -66,8 +64,6 @@ public final class IncomingCommandBuilder
* Constructs a new {@link IncomingCommandBuilder}, this constructor should
* only be called from the {@link RepositoryService}.
*
* @param cacheManager cache manager
*
* @param cacheManger
* @param command implementation of the {@link IncomingCommand}
* @param repository repository to query
@@ -91,11 +87,10 @@ public final class IncomingCommandBuilder
* @return incoming changesets
*
* @throws IOException
* @throws RepositoryException
*/
public ChangesetPagingResult getIncomingChangesets(
Repository remoteRepository)
throws IOException, RepositoryException
throws IOException
{
Subject subject = SecurityUtils.getSubject();

View File

@@ -37,10 +37,8 @@ package sonia.scm.repository.api;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.cache.Cache;
import sonia.scm.cache.CacheManager;
import sonia.scm.repository.Changeset;
@@ -48,15 +46,15 @@ import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.PreProcessorUtil;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryCacheKey;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.RevisionNotFoundException;
import sonia.scm.repository.spi.LogCommand;
import sonia.scm.repository.spi.LogCommandRequest;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* LogCommandBuilder is able to show the history of a file in a
* {@link Repository} or the entire history of a {@link Repository}.
@@ -166,11 +164,8 @@ public final class LogCommandBuilder
* @return the {@link Changeset} with the given id or null
*
* @throws IOException
* @throws RepositoryException
*/
public Changeset getChangeset(String id)
throws IOException, RepositoryException
{
public Changeset getChangeset(String id) throws IOException, RevisionNotFoundException {
Changeset changeset;
if (disableCache)
@@ -228,11 +223,8 @@ public final class LogCommandBuilder
* @return all changesets with the given parameters
*
* @throws IOException
* @throws RepositoryException
*/
public ChangesetPagingResult getChangesets()
throws IOException, RepositoryException
{
public ChangesetPagingResult getChangesets() throws IOException, RevisionNotFoundException {
ChangesetPagingResult cpr;
if (disableCache)

View File

@@ -30,7 +30,6 @@
*/
package sonia.scm.repository.api;
import java.io.IOException;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import sonia.scm.cache.CacheManager;
@@ -38,11 +37,12 @@ import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.PermissionType;
import sonia.scm.repository.PreProcessorUtil;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.spi.OutgoingCommand;
import sonia.scm.repository.spi.OutgoingCommandRequest;
import sonia.scm.security.RepositoryPermission;
import java.io.IOException;
/**
* Show changesets not found in a remote repository.
*
@@ -62,7 +62,7 @@ public final class OutgoingCommandBuilder
* @param repository repository to query
* @param preProcessorUtil pre processor util
*/
OutgoingCommandBuilder(CacheManager cacheManger, OutgoingCommand command,
OutgoingCommandBuilder(CacheManager cacheManager, OutgoingCommand command,
Repository repository, PreProcessorUtil preProcessorUtil)
{
this.command = command;
@@ -80,7 +80,7 @@ public final class OutgoingCommandBuilder
* @return outgoing changesets
*/
public ChangesetPagingResult getOutgoingChangesets(
Repository remoteRepository) throws IOException, RepositoryException
Repository remoteRepository) throws IOException
{
Subject subject = SecurityUtils.getSubject();

View File

@@ -36,22 +36,19 @@ package sonia.scm.repository.api;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.PermissionType;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.spi.PullCommand;
import sonia.scm.repository.spi.PullCommandRequest;
import sonia.scm.security.RepositoryPermission;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.net.URL;
//~--- JDK imports ------------------------------------------------------------
/**
* The pull command pull changes from a other repository.
*
@@ -93,13 +90,10 @@ public final class PullCommandBuilder
* @return informations over the executed pull command
*
* @throws IOException
* @throws RepositoryException
*
* @since 1.43
*/
public PullResponse pull(String url)
throws IOException, RepositoryException
{
public PullResponse pull(String url) throws IOException {
Subject subject = SecurityUtils.getSubject();
//J-
subject.checkPermission(
@@ -125,11 +119,8 @@ public final class PullCommandBuilder
* @return informations over the executed pull command
*
* @throws IOException
* @throws RepositoryException
*/
public PullResponse pull(Repository remoteRepository)
throws IOException, RepositoryException
{
public PullResponse pull(Repository remoteRepository) throws IOException {
Subject subject = SecurityUtils.getSubject();
//J-

View File

@@ -37,23 +37,19 @@ package sonia.scm.repository.api;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.PermissionType;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.spi.PushCommand;
import sonia.scm.repository.spi.PushCommandRequest;
import sonia.scm.security.RepositoryPermission;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.net.URL;
//~--- JDK imports ------------------------------------------------------------
/**
* The push command push changes to a other repository.
*
@@ -91,11 +87,8 @@ public final class PushCommandBuilder
* @return informations of the executed push command
*
* @throws IOException
* @throws RepositoryException
*/
public PushResponse push(Repository remoteRepository)
throws IOException, RepositoryException
{
public PushResponse push(Repository remoteRepository) throws IOException {
Subject subject = SecurityUtils.getSubject();
//J-
@@ -120,12 +113,10 @@ public final class PushCommandBuilder
* @return informations of the executed push command
*
* @throws IOException
* @throws RepositoryException
*
* @since 1.43
*/
public PushResponse push(String url) throws IOException, RepositoryException
{
public PushResponse push(String url) throws IOException {
URL remoteUrl = new URL(url);

View File

@@ -167,9 +167,7 @@ public final class RepositoryServiceFactory
* @throws ScmSecurityException if current user has not read permissions
* for that repository
*/
public RepositoryService create(String repositoryId)
throws RepositoryNotFoundException
{
public RepositoryService create(String repositoryId) throws RepositoryNotFoundException {
Preconditions.checkArgument(!Strings.isNullOrEmpty(repositoryId),
"a non empty repositoryId is required");
@@ -328,7 +326,6 @@ public final class RepositoryServiceFactory
/**
* Clear caches on repository delete event.
*
* @param repository changed repository
* @param event repository event
*/
@Subscribe(referenceType = ReferenceType.STRONG)

View File

@@ -36,25 +36,21 @@ package sonia.scm.repository.api;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.cache.Cache;
import sonia.scm.cache.CacheManager;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryCacheKey;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.Tag;
import sonia.scm.repository.Tags;
import sonia.scm.repository.spi.TagsCommand;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
* The tags command list all repository tags.<br />
* <br />
@@ -88,8 +84,7 @@ public final class TagsCommandBuilder
* only be called from the {@link RepositoryService}.
*
* @param cacheManager cache manager
* @param logCommand implementation of the {@link TagsCommand}
* @param command
* @param command implementation of the {@link TagsCommand}
* @param repository repository
*/
TagsCommandBuilder(CacheManager cacheManager, TagsCommand command,
@@ -109,10 +104,8 @@ public final class TagsCommandBuilder
* @return tags from the repository
*
* @throws IOException
* @throws RepositoryException
*/
public Tags getTags() throws RepositoryException, IOException
{
public Tags getTags() throws IOException {
Tags tags;
if (disableCache)
@@ -183,9 +176,8 @@ public final class TagsCommandBuilder
* @return
*
* @throws IOException
* @throws RepositoryException
*/
private Tags getTagsFromCommand() throws RepositoryException, IOException
private Tags getTagsFromCommand() throws IOException
{
List<Tag> tagList = command.getTags();

View File

@@ -37,25 +37,22 @@ package sonia.scm.repository.api;
import com.google.common.io.ByteSource;
import com.google.common.io.Files;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.spi.UnbundleCommand;
import sonia.scm.repository.spi.UnbundleCommandRequest;
import static com.google.common.base.Preconditions.*;
//~--- JDK imports ------------------------------------------------------------
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
//~--- JDK imports ------------------------------------------------------------
/**
* The unbundle command can restore an empty repository from a bundle. The
* bundle can be created with the {@link BundleCommandBuilder}.
@@ -97,10 +94,9 @@ public final class UnbundleCommandBuilder
* @return unbundle response
*
* @throws IOException
* @throws RepositoryException
*/
public UnbundleResponse unbundle(File inputFile)
throws IOException, RepositoryException
throws IOException
{
checkArgument((inputFile != null) && inputFile.exists(),
"existing file is required");
@@ -122,10 +118,9 @@ public final class UnbundleCommandBuilder
* @return unbundle response
*
* @throws IOException
* @throws RepositoryException
*/
public UnbundleResponse unbundle(InputStream inputStream)
throws IOException, RepositoryException
throws IOException
{
checkNotNull(inputStream, "input stream is required");
logger.info("unbundle archive from stream");
@@ -142,10 +137,9 @@ public final class UnbundleCommandBuilder
* @return unbundle response
*
* @throws IOException
* @throws RepositoryException
*/
public UnbundleResponse unbundle(ByteSource byteSource)
throws IOException, RepositoryException
throws IOException
{
checkNotNull(byteSource, "byte source is required");
logger.info("unbundle from byte source");
@@ -186,7 +180,7 @@ public final class UnbundleCommandBuilder
{
@Override
public InputStream openStream() throws IOException
public InputStream openStream()
{
return inputStream;
}

View File

@@ -36,12 +36,11 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.BlameResult;
import sonia.scm.repository.RepositoryException;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -59,8 +58,6 @@ public interface BlameCommand
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public BlameResult getBlameResult(BlameCommandRequest request)
throws IOException, RepositoryException;
BlameResult getBlameResult(BlameCommandRequest request) throws IOException;
}

View File

@@ -35,14 +35,12 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.Branch;
import sonia.scm.repository.RepositoryException;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -58,7 +56,6 @@ public interface BranchesCommand
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public List<Branch> getBranches() throws RepositoryException, IOException;
List<Branch> getBranches() throws IOException;
}

View File

@@ -36,12 +36,12 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.BrowserResult;
import sonia.scm.repository.RepositoryException;
//~--- JDK imports ------------------------------------------------------------
import sonia.scm.repository.RevisionNotFoundException;
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -59,8 +59,5 @@ public interface BrowseCommand
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public BrowserResult getBrowserResult(BrowseCommandRequest request)
throws IOException, RepositoryException;
}
BrowserResult getBrowserResult(BrowseCommandRequest request) throws IOException, RevisionNotFoundException;}

View File

@@ -35,8 +35,8 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
/**
*
* @author Sebastian Sdorra
@@ -127,7 +127,7 @@ public final class BrowseCommandRequest extends FileBaseCommandRequest
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("path", getPath())
.add("revision", getRevision())
.add("recursive", recursive)

View File

@@ -35,13 +35,12 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.api.BundleResponse;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
* Service provider implementation for the bundle command.
*
@@ -60,8 +59,7 @@ public interface BundleCommand
* @return bundle response
*
* @throws IOException
* @throws RepositoryException
*/
public BundleResponse bundle(BundleCommandRequest request)
throws IOException, RepositoryException;
throws IOException;
}

View File

@@ -33,7 +33,8 @@
package sonia.scm.repository.spi;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.PathNotFoundException;
import sonia.scm.repository.RevisionNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -46,7 +47,7 @@ import java.io.OutputStream;
*/
public interface CatCommand {
void getCatResult(CatCommandRequest request, OutputStream output) throws IOException, RepositoryException;
void getCatResult(CatCommandRequest request, OutputStream output) throws IOException, RevisionNotFoundException, PathNotFoundException;
InputStream getCatResultStream(CatCommandRequest request) throws IOException, RepositoryException;
InputStream getCatResultStream(CatCommandRequest request) throws IOException, RevisionNotFoundException, PathNotFoundException;
}

View File

@@ -33,11 +33,7 @@
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.RepositoryException;
//~--- JDK imports ------------------------------------------------------------
import sonia.scm.repository.RevisionNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
@@ -59,8 +55,6 @@ public interface DiffCommand
*
* @throws IOException
* @throws RuntimeException
* @throws RepositoryException
*/
public void getDiffResult(DiffCommandRequest request, OutputStream output)
throws IOException, RepositoryException;
public void getDiffResult(DiffCommandRequest request, OutputStream output) throws IOException, RevisionNotFoundException;
}

View File

@@ -35,12 +35,13 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -115,7 +116,7 @@ public abstract class FileBaseCommandRequest
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("path", path)
.add("revision", revision)
.toString();

View File

@@ -37,7 +37,6 @@ import com.google.inject.Inject;
import com.google.inject.Provider;
import sonia.scm.repository.NamespaceAndName;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.RepositoryHookEvent;
import sonia.scm.repository.RepositoryHookType;
import sonia.scm.repository.RepositoryManager;
@@ -72,19 +71,18 @@ public final class HookEventFacade
//~--- methods --------------------------------------------------------------
public HookEventHandler handle(String id) throws RepositoryException {
public HookEventHandler handle(String id) throws RepositoryNotFoundException {
return handle(repositoryManagerProvider.get().get(id));
}
public HookEventHandler handle(NamespaceAndName namespaceAndName) throws RepositoryException {
public HookEventHandler handle(NamespaceAndName namespaceAndName) throws RepositoryNotFoundException {
return handle(repositoryManagerProvider.get().get(namespaceAndName));
}
public HookEventHandler handle(Repository repository) throws RepositoryException
{
public HookEventHandler handle(Repository repository) throws RepositoryNotFoundException {
if (repository == null)
{
throw new RepositoryNotFoundException("could not find repository");
throw new RepositoryNotFoundException(repository);
}
return new HookEventHandler(repositoryManagerProvider.get(),

View File

@@ -35,12 +35,11 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.RepositoryException;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -49,18 +48,5 @@ import java.io.IOException;
public interface IncomingCommand
{
/**
* Method description
*
*
* @param request
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public ChangesetPagingResult getIncomingChangesets(
IncomingCommandRequest request)
throws IOException, RepositoryException;
ChangesetPagingResult getIncomingChangesets(IncomingCommandRequest request) throws IOException;
}

View File

@@ -37,45 +37,20 @@ package sonia.scm.repository.spi;
import sonia.scm.repository.Changeset;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.RepositoryException;
//~--- JDK imports ------------------------------------------------------------
import sonia.scm.repository.RevisionNotFoundException;
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
* @since 1.17
*/
public interface LogCommand
{
public interface LogCommand {
/**
* Method description
*
*
* @param id
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public Changeset getChangeset(String id)
throws IOException, RepositoryException;
Changeset getChangeset(String id) throws IOException, RevisionNotFoundException;
/**
* Method description
*
*
* @param request
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public ChangesetPagingResult getChangesets(LogCommandRequest request)
throws IOException, RepositoryException;
ChangesetPagingResult getChangesets(LogCommandRequest request) throws IOException, RevisionNotFoundException;
}

View File

@@ -35,12 +35,13 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -125,7 +126,7 @@ public final class LogCommandRequest implements Serializable, Resetable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("startChangeset", startChangeset)
.add("endChangeset", endChangeset)
.add("pagingStart", pagingStart)

View File

@@ -35,12 +35,11 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.RepositoryException;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -58,9 +57,6 @@ public interface OutgoingCommand
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public ChangesetPagingResult getOutgoingChangesets(
OutgoingCommandRequest request)
throws IOException, RepositoryException;
ChangesetPagingResult getOutgoingChangesets(OutgoingCommandRequest request) throws IOException;
}

View File

@@ -34,8 +34,8 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
/**
*
* @author Sebastian Sdorra
@@ -84,7 +84,7 @@ public abstract class PagedRemoteCommandRequest extends RemoteCommandRequest
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("remoteURL", remoteRepository)
.add("pagingStart", pagingStart)
.add("pagingLimit", pagingLimit)

View File

@@ -34,13 +34,12 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.api.PullResponse;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -58,8 +57,6 @@ public interface PullCommand
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public PullResponse pull(PullCommandRequest request)
throws IOException, RepositoryException;
PullResponse pull(PullCommandRequest request) throws IOException;
}

View File

@@ -34,13 +34,12 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.api.PushResponse;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -58,8 +57,6 @@ public interface PushCommand
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public PushResponse push(PushCommandRequest request)
throws IOException, RepositoryException;
PushResponse push(PushCommandRequest request) throws IOException;
}

View File

@@ -35,14 +35,14 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import sonia.scm.repository.Repository;
//~--- JDK imports ------------------------------------------------------------
import java.net.URL;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -101,7 +101,7 @@ public abstract class RemoteCommandRequest implements Resetable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("remoteRepository", remoteRepository)
.add("remoteUrl", remoteUrl)
.toString();

View File

@@ -34,15 +34,13 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.Tag;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.util.List;
//~--- JDK imports ------------------------------------------------------------
/**
*
* @author Sebastian Sdorra
@@ -57,7 +55,6 @@ public interface TagsCommand
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public List<Tag> getTags() throws RepositoryException, IOException;
public List<Tag> getTags() throws IOException;
}

View File

@@ -35,13 +35,12 @@ package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.api.UnbundleResponse;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
//~--- JDK imports ------------------------------------------------------------
/**
* Service provider implementation for the unbundle command.
*
@@ -60,8 +59,7 @@ public interface UnbundleCommand
* @return unbundle response
*
* @throws IOException
* @throws RepositoryException
*/
public UnbundleResponse unbundle(UnbundleCommandRequest request)
throws IOException, RepositoryException;
throws IOException;
}

View File

@@ -34,16 +34,16 @@ package sonia.scm.security;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* Permission object which is assigned to a specific user or group.
@@ -150,7 +150,7 @@ public class AssignedPermission implements PermissionObject, Serializable
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("name", name)
.add("groupPermisison", groupPermission)
.add("permission", permission)

View File

@@ -33,11 +33,10 @@ package sonia.scm.security;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
@@ -47,10 +46,8 @@ import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authc.credential.CredentialsMatcher;
import org.apache.shiro.subject.SimplePrincipalCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.group.Group;
import sonia.scm.group.GroupDAO;
import sonia.scm.group.GroupNames;
@@ -161,7 +158,7 @@ public final class DAORealmHelper
collection.add(principal, realm);
collection.add(user, realm);
collection.add(collectGroups(principal), realm);
collection.add(Objects.firstNonNull(scope, Scope.empty()), realm);
collection.add(MoreObjects.firstNonNull(scope, Scope.empty()), realm);
String creds = credentials;

View File

@@ -34,16 +34,16 @@ package sonia.scm.security;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* Descriptor for available permission objects.
@@ -125,7 +125,7 @@ public class PermissionDescriptor implements Serializable
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("displayName", displayName)
.add("description", description)
.add("value", value)

View File

@@ -35,17 +35,16 @@ package sonia.scm.security;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import org.apache.shiro.authz.Permission;
import sonia.scm.repository.PermissionType;
import sonia.scm.repository.Repository;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
//~--- JDK imports ------------------------------------------------------------
/**
* This class represents the permission to a repository of a user.
*
@@ -174,7 +173,7 @@ public final class RepositoryPermission
public String toString()
{
//J-
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("repositoryId", repositoryId)
.add("permissionType", permissionType)
.toString();

Some files were not shown because too many files have changed in this diff Show More