diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-08-30 11:53:25 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-08-30 11:53:25 -0700 |
commit | e6bd689d2c48efb4e6662ffca2fbdbc7570d2db1 (patch) | |
tree | 0b19b3c1a845a0626c61ba1c7954cfd2f8844834 /org.eclipse.jgit.test | |
parent | a3945d1bc856322becdc4d1ec8df9013bfef3175 (diff) | |
download | jgit-e6bd689d2c48efb4e6662ffca2fbdbc7570d2db1.tar.gz jgit-e6bd689d2c48efb4e6662ffca2fbdbc7570d2db1.zip |
Improve LargeObjectException reporting
Use 3 different types of LargeObjectException for the 3 major ways
that we can fail to load an object. For each of these use a unique
string translation which describes the root cause better than just
the ObjectId.name() does.
Change-Id: I810c98d5691b74af9fc6cbd46fc9879e35a7bdca
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java | 14 | ||||
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java | 8 |
2 files changed, 17 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java index f31bf558c8..9a4bc0b1ab 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java @@ -47,9 +47,11 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.security.MessageDigest; +import java.text.MessageFormat; import java.util.Arrays; import java.util.zip.Deflater; +import org.eclipse.jgit.JGitText; import org.eclipse.jgit.errors.LargeObjectException; import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; import org.eclipse.jgit.junit.TestRepository; @@ -133,7 +135,9 @@ public class PackFileTest extends LocalDiskRepositoryTestCase { ol.getCachedBytes(); fail("Should have thrown LargeObjectException"); } catch (LargeObjectException tooBig) { - assertEquals(id.name(), tooBig.getMessage()); + assertEquals(MessageFormat.format( + JGitText.get().largeObjectException, id.name()), tooBig + .getMessage()); } ObjectStream in = ol.openStream(); @@ -257,7 +261,9 @@ public class PackFileTest extends LocalDiskRepositoryTestCase { ol.getCachedBytes(); fail("Should have thrown LargeObjectException"); } catch (LargeObjectException tooBig) { - assertEquals(id3.name(), tooBig.getMessage()); + assertEquals(MessageFormat.format( + JGitText.get().largeObjectException, id3.name()), tooBig + .getMessage()); } ObjectStream in = ol.openStream(); @@ -313,7 +319,9 @@ public class PackFileTest extends LocalDiskRepositoryTestCase { ol.getCachedBytes(); fail("Should have thrown LargeObjectException"); } catch (LargeObjectException tooBig) { - assertEquals(id3.name(), tooBig.getMessage()); + assertEquals(MessageFormat.format( + JGitText.get().largeObjectException, id3.name()), tooBig + .getMessage()); } ObjectStream in = ol.openStream(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java index 25dfe4c239..ab7445b17b 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java @@ -135,7 +135,9 @@ public class UnpackedObjectTest extends LocalDiskRepositoryTestCase { ol.getCachedBytes(); fail("Should have thrown LargeObjectException"); } catch (LargeObjectException tooBig) { - assertEquals(id.name(), tooBig.getMessage()); + assertEquals(MessageFormat.format( + JGitText.get().largeObjectException, id.name()), tooBig + .getMessage()); } ObjectStream in = ol.openStream(); @@ -416,7 +418,9 @@ public class UnpackedObjectTest extends LocalDiskRepositoryTestCase { ol.getCachedBytes(); fail("Should have thrown LargeObjectException"); } catch (LargeObjectException tooBig) { - assertEquals(id.name(), tooBig.getMessage()); + assertEquals(MessageFormat.format( + JGitText.get().largeObjectException, id.name()), tooBig + .getMessage()); } ObjectStream in = ol.openStream(); |