aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-07-30 17:50:58 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-08-20 17:41:27 -0700
commitde78cf33672813feecce36637694b189f1c10082 (patch)
tree4ee79b3d1b4c7ec13d4f524cda0647470455ba35 /org.eclipse.jgit
parent69f8fa31be85e9fbb6befa6cadf98c95c49a5c83 (diff)
downloadjgit-de78cf33672813feecce36637694b189f1c10082.tar.gz
jgit-de78cf33672813feecce36637694b189f1c10082.zip
Export the ObjectId on MissingObjectException
Callers catching a MissingObjectException may need programmatic access to the ObjectId that wasn't available in the repository. Change-Id: I2be0380251ebe7e4921fa74e246724e48ad88b0e Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java
index 1d193e18c7..1807a6cfc5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java
@@ -59,6 +59,8 @@ import org.eclipse.jgit.lib.ObjectId;
public class MissingObjectException extends IOException {
private static final long serialVersionUID = 1L;
+ private final ObjectId missing;
+
/**
* Construct a MissingObjectException for the specified object id.
* Expected type is reported to simplify tracking down the problem.
@@ -68,6 +70,7 @@ public class MissingObjectException extends IOException {
*/
public MissingObjectException(final ObjectId id, final String type) {
super(MessageFormat.format(JGitText.get().missingObject, type, id.name()));
+ missing = id.copy();
}
/**
@@ -80,4 +83,9 @@ public class MissingObjectException extends IOException {
public MissingObjectException(final ObjectId id, final int type) {
this(id, Constants.typeString(type));
}
+
+ /** @return the ObjectId that was not found. */
+ public ObjectId getObjectId() {
+ return missing;
+ }
}