diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java index 478ed05b44..618efa199e 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/AbstractHgHandler.java @@ -66,12 +66,21 @@ import javax.xml.bind.JAXBException; public class AbstractHgHandler { + /** Field description */ + public static final String ENV_NODE = "HG_NODE"; + + /** Field description */ + public static final String ENV_PAGE_LIMIT = "SCM_PAGE_LIMIT"; + + /** Field description */ + public static final String ENV_PAGE_START = "SCM_PAGE_START"; + /** Field description */ public static final String ENV_PATH = "SCM_PATH"; /** Field description */ public static final String ENV_PENDING = "HG_PENDING"; - + /** Field description */ public static final String ENV_PYTHON_PATH = "SCM_PYTHON_PATH"; @@ -80,21 +89,12 @@ public class AbstractHgHandler /** Field description */ public static final String ENV_REVISION = "SCM_REVISION"; - - /** Field description */ - public static final String ENV_PAGE_LIMIT = "SCM_PAGE_LIMIT"; - - /** Field description */ - public static final String ENV_PAGE_START = "SCM_PAGE_START"; /** Field description */ public static final String ENV_REVISION_END = "SCM_REVISION_END"; /** Field description */ public static final String ENV_REVISION_START = "SCM_REVISION_START"; - - /** Field description */ - public static final String ENV_NODE = "HG_NODE"; /** the logger for AbstractHgHandler */ private static final Logger logger = @@ -294,10 +294,11 @@ public class AbstractHgHandler * @return * * @throws IOException + * @throws RepositoryException */ protected T getResultFromScript(Class resultType, String scriptResource) - throws IOException + throws IOException, RepositoryException { return getResultFromScript(resultType, scriptResource, new HashMap()); @@ -315,10 +316,11 @@ public class AbstractHgHandler * @return * * @throws IOException + * @throws RepositoryException */ protected T getResultFromScript(Class resultType, String scriptResource, Map extraEnv) - throws IOException + throws IOException, RepositoryException { Process p = createPythonProcess(extraEnv); T result = null; @@ -340,6 +342,8 @@ public class AbstractHgHandler catch (JAXBException ex) { logger.error("could not parse result", ex); + + throw new RepositoryException("could not parse result", ex); } finally { @@ -411,8 +415,8 @@ public class AbstractHgHandler if (context.isPending()) { env.put(ENV_PENDING, directory.getAbsolutePath()); - - if ( extraEnv.containsKey( ENV_REVISION_START ) ) + + if (extraEnv.containsKey(ENV_REVISION_START)) { env.put(ENV_NODE, extraEnv.get(ENV_REVISION_START)); } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgBlameViewer.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgBlameViewer.java index 14e5ff3812..6ea770d36e 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgBlameViewer.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgBlameViewer.java @@ -93,9 +93,11 @@ public class HgBlameViewer extends AbstractHgHandler implements BlameViewer * @return * * @throws IOException + * @throws RepositoryException */ @Override - public BlameResult getBlame(String revision, String path) throws IOException + public BlameResult getBlame(String revision, String path) + throws IOException, RepositoryException { AssertUtil.assertIsNotEmpty(path); diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgChangesetViewer.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgChangesetViewer.java index 5746749050..07ca49deca 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgChangesetViewer.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgChangesetViewer.java @@ -104,10 +104,11 @@ public class HgChangesetViewer extends AbstractHgHandler * @return * * @throws IOException + * @throws RepositoryException */ @Override public ChangesetPagingResult getChangesets(int start, int max) - throws IOException + throws IOException, RepositoryException { return getChangesets(String.valueOf(start), String.valueOf(max), null, null); @@ -125,10 +126,11 @@ public class HgChangesetViewer extends AbstractHgHandler * @return * * @throws IOException + * @throws RepositoryException */ public ChangesetPagingResult getChangesets(String pageStart, String pageLimit, String revisionStart, String revisionEnd) - throws IOException + throws IOException, RepositoryException { Map env = new HashMap(); @@ -150,9 +152,10 @@ public class HgChangesetViewer extends AbstractHgHandler * @return * * @throws IOException + * @throws RepositoryException */ public ChangesetPagingResult getChangesets(String startNode, String endNode) - throws IOException + throws IOException, RepositoryException { return getChangesets(null, null, startNode, endNode); } diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHookEvent.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHookEvent.java index eb9e3bdc8b..24e424bdc1 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHookEvent.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHookEvent.java @@ -33,15 +33,9 @@ package sonia.scm.repository; -//~--- non-JDK imports -------------------------------------------------------- - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - //~--- JDK imports ------------------------------------------------------------ import java.io.File; -import java.io.IOException; import java.util.Collection; import java.util.List; @@ -56,10 +50,6 @@ public class HgRepositoryHookEvent extends AbstractRepositoryHookEvent /** Field description */ public static final String REV_TIP = "tip"; - /** the logger for HgRepositoryHookEvent */ - private static final Logger logger = - LoggerFactory.getLogger(HgRepositoryHookEvent.class); - //~--- constructors --------------------------------------------------------- /** @@ -104,9 +94,9 @@ public class HgRepositoryHookEvent extends AbstractRepositoryHookEvent changesets = result.getChangesets(); } } - catch (IOException ex) + catch (Exception ex) { - logger.error("could not load changesets", ex); + throw new RuntimeException("could not load changesets", ex); } }