diff options
author | Robin Stocker <robin@nibor.org> | 2012-10-13 18:38:51 +0200 |
---|---|---|
committer | Robin Stocker <robin@nibor.org> | 2012-10-13 18:40:46 +0200 |
commit | 6dadc801bdd8e2715e7351f1279ef3b3d59763cc (patch) | |
tree | 8ce034f0cb1f45a181e64d3f432a2d0969b0b077 /org.eclipse.jgit.test | |
parent | 14164e040c5b2bb31ba68754516045253be81506 (diff) | |
download | jgit-6dadc801bdd8e2715e7351f1279ef3b3d59763cc.tar.gz jgit-6dadc801bdd8e2715e7351f1279ef3b3d59763cc.zip |
Don't allow null name or e-mail in PersonIdent
toExternalString, equals and hashCode don't expect them to be null, so
explicitly disallow it in the constructor.
Also fix the documentation of setAuthor and setCommitter in
CommitCommand when specifying name and email as separate arguments.
Bug: 352984
Change-Id: I0ac994ae8e47789d38f7c6e6db55d482f0f1bac3
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0001_PersonIdentTest.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0001_PersonIdentTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0001_PersonIdentTest.java index 34a557bd92..1b7276bf77 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0001_PersonIdentTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0001_PersonIdentTest.java @@ -73,4 +73,14 @@ public class T0001_PersonIdentTest { assertEquals("A U Thor <author@example.com> 1142878501 +0230", p.toExternalString()); } + + @Test(expected = IllegalArgumentException.class) + public void nullForNameShouldThrowIllegalArgumentException() { + new PersonIdent(null, "author@example.com"); + } + + @Test(expected = IllegalArgumentException.class) + public void nullForEmailShouldThrowIllegalArgumentException() { + new PersonIdent("A U Thor", null); + } } |