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 1d193e18c..1807a6cfc 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; + } }