From 6dadc801bdd8e2715e7351f1279ef3b3d59763cc Mon Sep 17 00:00:00 2001 From: Robin Stocker Date: Sat, 13 Oct 2012 18:38:51 +0200 Subject: 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 --- .../tst/org/eclipse/jgit/lib/T0001_PersonIdentTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'org.eclipse.jgit.test') 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 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); + } } -- cgit v1.2.3