Browse Source

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>
stable-0.9
Shawn O. Pearce 14 years ago
parent
commit
de78cf3367
  1. 8
      org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java

8
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;
}
}

Loading…
Cancel
Save