summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Aniszczyk <caniszczyk@gmail.com>2010-08-25 19:54:32 -0400
committerCode Review <codereview-daemon@eclipse.org>2010-08-25 19:54:32 -0400
commite69dcc703d9e11448108498d08888170b3861ea8 (patch)
treed3441bbcd28f558c2660ae38935783b282fc5b73
parentf74d474f3c6e03b82f70d2ccc92f84c070812fc5 (diff)
parent1f4b48a37c73c3bf3f623b7a5de5f03e38ec6db7 (diff)
downloadjgit-e69dcc703d9e11448108498d08888170b3861ea8.tar.gz
jgit-e69dcc703d9e11448108498d08888170b3861ea8.zip
Merge "Add ObjectId to the LargeObjectException"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java
index d897c51de1..f77aecbb42 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java
@@ -43,12 +43,15 @@
package org.eclipse.jgit.errors;
+import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.ObjectId;
/** An object is too big to load into memory as a single byte array. */
public class LargeObjectException extends RuntimeException {
private static final long serialVersionUID = 1L;
+ private ObjectId objectId;
+
/** Create a large object exception, where the object isn't known. */
public LargeObjectException() {
// Do nothing.
@@ -61,7 +64,28 @@ public class LargeObjectException extends RuntimeException {
* identity of the object that is too big to be loaded as a byte
* array in this JVM.
*/
- public LargeObjectException(ObjectId id) {
- super(id.name());
+ public LargeObjectException(AnyObjectId id) {
+ setObjectId(id);
+ }
+
+ /** @return identity of the object that is too large; may be null. */
+ public ObjectId getObjectId() {
+ return objectId;
+ }
+
+ /**
+ * Set the identity of the object, if its not already set.
+ *
+ * @param id
+ * the id of the object that is too large to process.
+ */
+ public void setObjectId(AnyObjectId id) {
+ if (objectId == null)
+ objectId = id.copy();
+ }
+
+ @Override
+ public String getMessage() {
+ return objectId != null ? objectId.name() : getClass().getSimpleName();
}
}