Refactor Git API exceptions to a new package
Create a new 'org.eclipse.jgit.api.errors' package to contain exceptions related to using the Git porcelain API. Change-Id: Iac1781bd74fbd520dffac9d347616c3334994470 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
This commit is contained in:
parent
ea4ff61ad3
commit
38327a54a8
|
@ -7,6 +7,7 @@ Bundle-Vendor: %provider_name
|
|||
Bundle-Localization: plugin
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Import-Package: org.eclipse.jgit.api;version="[0.9.0,0.10.0)",
|
||||
org.eclipse.jgit.api.errors;version="[0.9.0,0.10.0)",
|
||||
org.eclipse.jgit.awtui;version="[0.9.0,0.10.0)",
|
||||
org.eclipse.jgit.diff;version="[0.9.0,0.10.0)",
|
||||
org.eclipse.jgit.dircache;version="[0.9.0,0.10.0)",
|
||||
|
|
|
@ -38,11 +38,11 @@
|
|||
package org.eclipse.jgit.pgm;
|
||||
|
||||
import org.eclipse.jgit.api.CommitCommand;
|
||||
import org.eclipse.jgit.api.ConcurrentRefUpdateException;
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.JGitInternalException;
|
||||
import org.eclipse.jgit.api.NoHeadException;
|
||||
import org.eclipse.jgit.api.NoMessageException;
|
||||
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
|
||||
import org.eclipse.jgit.api.errors.JGitInternalException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.api.errors.NoMessageException;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
|
|
|
@ -11,6 +11,7 @@ Import-Package: junit.framework;version="[4.0.0,5.0.0)",
|
|||
junit.textui;version="[3.8.2,4.0.0)",
|
||||
org.eclipse.jgit;version="[0.9.0,0.10.0)",
|
||||
org.eclipse.jgit.api;version="[0.9.0,0.10.0)",
|
||||
org.eclipse.jgit.api.errors;version="[0.9.0,0.10.0)",
|
||||
org.eclipse.jgit.awtui;version="[0.9.0,0.10.0)",
|
||||
org.eclipse.jgit.console;version="[0.9.0,0.10.0)",
|
||||
org.eclipse.jgit.diff;version="[0.9.0,0.10.0)",
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import org.eclipse.jgit.api.errors.NoFilepatternException;
|
||||
import org.eclipse.jgit.dircache.DirCache;
|
||||
import org.eclipse.jgit.dircache.DirCacheBuilder;
|
||||
import org.eclipse.jgit.dircache.DirCacheEntry;
|
||||
|
|
|
@ -47,6 +47,12 @@
|
|||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
|
||||
import org.eclipse.jgit.api.errors.JGitInternalException;
|
||||
import org.eclipse.jgit.api.errors.NoFilepatternException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.api.errors.NoMessageException;
|
||||
import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
|
||||
import org.eclipse.jgit.errors.UnmergedPathException;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.jgit.api.MergeResult.MergeStatus;
|
||||
import org.eclipse.jgit.api.errors.InvalidMergeHeadsException;
|
||||
import org.eclipse.jgit.dircache.DirCacheCheckout;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
*/
|
||||
package org.eclipse.jgit.api;
|
||||
|
||||
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
|
||||
import org.eclipse.jgit.api.errors.InvalidTagNameException;
|
||||
import org.eclipse.jgit.api.errors.JGitInternalException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.api.errors.NoMessageException;
|
||||
import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
|
||||
import org.eclipse.jgit.errors.UnmergedPathException;
|
||||
import org.eclipse.jgit.lib.RepositoryTestCase;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
|
|
|
@ -7,10 +7,11 @@ Bundle-Localization: plugin
|
|||
Bundle-Vendor: %provider_name
|
||||
Export-Package: org.eclipse.jgit;version="0.9.0",
|
||||
org.eclipse.jgit.api;version="0.9.0",
|
||||
org.eclipse.jgit.api.errors;version="0.9.0",
|
||||
org.eclipse.jgit.diff;version="0.9.0",
|
||||
org.eclipse.jgit.dircache;version="0.9.0",
|
||||
org.eclipse.jgit.events;version="0.9.0",
|
||||
org.eclipse.jgit.errors;version="0.9.0",
|
||||
org.eclipse.jgit.events;version="0.9.0",
|
||||
org.eclipse.jgit.fnmatch;version="0.9.0",
|
||||
org.eclipse.jgit.ignore;version="0.9.0",
|
||||
org.eclipse.jgit.lib;version="0.9.0",
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
import java.util.LinkedList;
|
||||
|
||||
import org.eclipse.jgit.JGitText;
|
||||
import org.eclipse.jgit.api.errors.JGitInternalException;
|
||||
import org.eclipse.jgit.api.errors.NoFilepatternException;
|
||||
import org.eclipse.jgit.dircache.DirCache;
|
||||
import org.eclipse.jgit.dircache.DirCacheBuildIterator;
|
||||
import org.eclipse.jgit.dircache.DirCacheBuilder;
|
||||
|
|
|
@ -48,6 +48,12 @@
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.jgit.JGitText;
|
||||
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
|
||||
import org.eclipse.jgit.api.errors.JGitInternalException;
|
||||
import org.eclipse.jgit.api.errors.NoFilepatternException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.api.errors.NoMessageException;
|
||||
import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
|
||||
import org.eclipse.jgit.dircache.DirCache;
|
||||
import org.eclipse.jgit.errors.UnmergedPathException;
|
||||
import org.eclipse.jgit.lib.CommitBuilder;
|
||||
|
@ -57,9 +63,9 @@
|
|||
import org.eclipse.jgit.lib.PersonIdent;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.lib.RefUpdate;
|
||||
import org.eclipse.jgit.lib.RefUpdate.Result;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.lib.RepositoryState;
|
||||
import org.eclipse.jgit.lib.RefUpdate.Result;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
import java.text.MessageFormat;
|
||||
|
||||
import org.eclipse.jgit.JGitText;
|
||||
import org.eclipse.jgit.api.errors.JGitInternalException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
||||
import org.eclipse.jgit.errors.MissingObjectException;
|
||||
import org.eclipse.jgit.lib.AnyObjectId;
|
||||
|
|
|
@ -52,16 +52,23 @@
|
|||
|
||||
import org.eclipse.jgit.JGitText;
|
||||
import org.eclipse.jgit.api.MergeResult.MergeStatus;
|
||||
import org.eclipse.jgit.api.errors.CheckoutConflictException;
|
||||
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
|
||||
import org.eclipse.jgit.api.errors.InvalidMergeHeadsException;
|
||||
import org.eclipse.jgit.api.errors.JGitInternalException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.api.errors.NoMessageException;
|
||||
import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
|
||||
import org.eclipse.jgit.dircache.DirCacheCheckout;
|
||||
import org.eclipse.jgit.lib.AnyObjectId;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.ObjectIdRef;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.lib.RefUpdate;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.lib.Ref.Storage;
|
||||
import org.eclipse.jgit.lib.RefUpdate;
|
||||
import org.eclipse.jgit.lib.RefUpdate.Result;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.merge.MergeStrategy;
|
||||
import org.eclipse.jgit.merge.ResolveMerger;
|
||||
import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason;
|
||||
|
|
|
@ -46,6 +46,10 @@
|
|||
import java.text.MessageFormat;
|
||||
|
||||
import org.eclipse.jgit.JGitText;
|
||||
import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
|
||||
import org.eclipse.jgit.api.errors.InvalidTagNameException;
|
||||
import org.eclipse.jgit.api.errors.JGitInternalException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.ObjectInserter;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.eclipse.jgit.api;
|
||||
package org.eclipse.jgit.api.errors;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
|
@ -35,7 +35,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.eclipse.jgit.api;
|
||||
package org.eclipse.jgit.api.errors;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
|
@ -54,7 +54,13 @@ public class ConcurrentRefUpdateException extends GitAPIException {
|
|||
private RefUpdate.Result rc;
|
||||
private Ref ref;
|
||||
|
||||
ConcurrentRefUpdateException(String message, Ref ref,
|
||||
/**
|
||||
* @param message
|
||||
* @param ref
|
||||
* @param rc
|
||||
* @param cause
|
||||
*/
|
||||
public ConcurrentRefUpdateException(String message, Ref ref,
|
||||
RefUpdate.Result rc, Throwable cause) {
|
||||
super((rc == null) ? message : message + ". "
|
||||
+ MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc), cause);
|
||||
|
@ -62,7 +68,12 @@ public class ConcurrentRefUpdateException extends GitAPIException {
|
|||
this.ref = ref;
|
||||
}
|
||||
|
||||
ConcurrentRefUpdateException(String message, Ref ref,
|
||||
/**
|
||||
* @param message
|
||||
* @param ref
|
||||
* @param rc
|
||||
*/
|
||||
public ConcurrentRefUpdateException(String message, Ref ref,
|
||||
RefUpdate.Result rc) {
|
||||
super((rc == null) ? message : message + ". "
|
||||
+ MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc));
|
|
@ -35,7 +35,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.eclipse.jgit.api;
|
||||
package org.eclipse.jgit.api.errors;
|
||||
|
||||
/**
|
||||
* Superclass of all exceptions thrown by the API classes in
|
|
@ -35,7 +35,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.eclipse.jgit.api;
|
||||
package org.eclipse.jgit.api.errors;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -47,7 +47,10 @@
|
|||
public class InvalidMergeHeadsException extends GitAPIException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
InvalidMergeHeadsException(String msg) {
|
||||
/**
|
||||
* @param msg
|
||||
*/
|
||||
public InvalidMergeHeadsException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.eclipse.jgit.api;
|
||||
package org.eclipse.jgit.api.errors;
|
||||
|
||||
/**
|
||||
* Exception thrown when a tag command was called with an invalid tag name (or
|
||||
|
@ -44,7 +44,10 @@
|
|||
public class InvalidTagNameException extends GitAPIException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
InvalidTagNameException(String msg) {
|
||||
/**
|
||||
* @param msg
|
||||
*/
|
||||
public InvalidTagNameException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.eclipse.jgit.api;
|
||||
package org.eclipse.jgit.api.errors;
|
||||
|
||||
/**
|
||||
* Exception thrown when during command execution a low-level exception from the
|
||||
|
@ -59,11 +59,18 @@
|
|||
public class JGitInternalException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
JGitInternalException(String message, Throwable cause) {
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public JGitInternalException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
JGitInternalException(String message) {
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public JGitInternalException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -37,7 +37,7 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.eclipse.jgit.api;
|
||||
package org.eclipse.jgit.api.errors;
|
||||
|
||||
/**
|
||||
* Exception thrown when the options given to a command don't include a
|
||||
|
@ -47,11 +47,18 @@ public class NoFilepatternException extends GitAPIException {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
NoFilepatternException(String message, Throwable cause) {
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public NoFilepatternException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
NoFilepatternException(String message) {
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public NoFilepatternException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.eclipse.jgit.api;
|
||||
package org.eclipse.jgit.api.errors;
|
||||
|
||||
/**
|
||||
* Exception thrown when a command expected the {@code HEAD} reference to exist
|
||||
|
@ -44,11 +44,18 @@
|
|||
public class NoHeadException extends GitAPIException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
NoHeadException(String message, Throwable cause) {
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public NoHeadException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
NoHeadException(String message) {
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public NoHeadException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.eclipse.jgit.api;
|
||||
package org.eclipse.jgit.api.errors;
|
||||
|
||||
/**
|
||||
* Exception thrown when the options given to a command don't include a
|
||||
|
@ -46,11 +46,18 @@
|
|||
public class NoMessageException extends GitAPIException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
NoMessageException(String message, Throwable cause) {
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public NoMessageException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
NoMessageException(String message) {
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public NoMessageException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.eclipse.jgit.api;
|
||||
package org.eclipse.jgit.api.errors;
|
||||
|
||||
/**
|
||||
* Exception thrown when the state of the repository doesn't allow the execution
|
||||
|
@ -45,11 +45,18 @@
|
|||
public class WrongRepositoryStateException extends GitAPIException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
WrongRepositoryStateException(String message, Throwable cause) {
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public WrongRepositoryStateException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
WrongRepositoryStateException(String message) {
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public WrongRepositoryStateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue