From 7d758aed6c3288268936c7de39a7fa69987d6c6b Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 18 Jun 2011 16:26:23 +0200 Subject: [PATCH] added not found repository exceptions --- .../scm/repository/PathNotFoundException.java | 81 +++++++++++++++++++ .../repository/RevisionNotFoundException.java | 81 +++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 scm-core/src/main/java/sonia/scm/repository/PathNotFoundException.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/RevisionNotFoundException.java diff --git a/scm-core/src/main/java/sonia/scm/repository/PathNotFoundException.java b/scm-core/src/main/java/sonia/scm/repository/PathNotFoundException.java new file mode 100644 index 0000000000..6454fa265c --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/PathNotFoundException.java @@ -0,0 +1,81 @@ +/** + * 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; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.util.Util; + +/** + * + * @author Sebastian Sdorra + */ +public class PathNotFoundException extends RepositoryException +{ + + /** Field description */ + private static final long serialVersionUID = 4629690181172951809L; + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param path + */ + public PathNotFoundException(String path) + { + super("path \"".concat(Util.nonNull(path)).concat("\" not found")); + this.path = Util.nonNull(path); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + public String getPath() + { + return path; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private String path; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/RevisionNotFoundException.java b/scm-core/src/main/java/sonia/scm/repository/RevisionNotFoundException.java new file mode 100644 index 0000000000..e9f2c95fe1 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/RevisionNotFoundException.java @@ -0,0 +1,81 @@ +/** + * 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; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.util.Util; + +/** + * + * @author Sebastian Sdorra + */ +public class RevisionNotFoundException extends RepositoryException +{ + + /** Field description */ + private static final long serialVersionUID = -5594008535358811998L; + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param revision + */ + public RevisionNotFoundException(String revision) + { + super("revision \"".concat(Util.nonNull(revision)).concat("\" not found")); + this.revision = Util.nonNull(revision); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + public String getRevision() + { + return revision; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private String revision; +}