diff options
author | Marc Strapetz <marc.strapetz@syntevo.com> | 2011-06-14 16:56:48 +0200 |
---|---|---|
committer | Marc Strapetz <marc.strapetz@syntevo.com> | 2011-06-14 16:56:48 +0200 |
commit | 929862f322cf7ca4c13f9515d611a21e2680e2ba (patch) | |
tree | c8e1cd64a756466584dff67ac6f59f2d9791f587 /org.eclipse.jgit.test/tst/org/eclipse/jgit | |
parent | 0ab7be9681912ef5d11fe10af1f7536c2feaa662 (diff) | |
download | jgit-929862f322cf7ca4c13f9515d611a21e2680e2ba.tar.gz jgit-929862f322cf7ca4c13f9515d611a21e2680e2ba.zip |
Fix IndexOutOfBoundsException when parsing PersonIdent
IndexOutOfBoundsException could occur when parsing
PersonIdent for which no name is present, as part of a
RevCommit (nameB > 0).
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java index 02a78a5baf..7dff6d1cea 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java @@ -162,6 +162,21 @@ public class RevCommitParseTest extends RepositoryTestCase { } @Test + public void testParse_incompleteAuthorAndCommitter() throws Exception { + final StringBuilder b = new StringBuilder(); + b.append("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n"); + b.append("author <a_u_thor@example.com> 1218123387 +0700\n"); + b.append("committer <> 1218123390 -0500\n"); + + final RevCommit c; + c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67")); + c.parseCanonical(new RevWalk(db), b.toString().getBytes("UTF-8")); + + assertEquals(new PersonIdent("", "a_u_thor@example.com", 1218123387000l, 7), c.getAuthorIdent()); + assertEquals(new PersonIdent("", "", 1218123390000l, -5), c.getCommitterIdent()); + } + + @Test public void testParse_implicit_UTF8_encoded() throws Exception { final ByteArrayOutputStream b = new ByteArrayOutputStream(); b.write("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n".getBytes("UTF-8")); |