From 466bec3cc9dad4166f80d05044111f9198308f8a Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 16 Apr 2010 08:43:06 -0700 Subject: [PATCH] ObjectIdSubclassMap: Correct Iterator to throw NoSuchElementException The Iterator contract says next() shall throw NoSuchElementException if there are no more items remaining in the iteration. We got this wrong when I originally wrote the implementation, so fix it. Change-Id: Iea25e6569ead5c8b3128b8a368c5b2caebec7ecc Signed-off-by: Shawn O. Pearce --- .../src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java index aa4bf99f3..612e00ea2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java @@ -46,6 +46,7 @@ package org.eclipse.jgit.lib; import java.util.Iterator; +import java.util.NoSuchElementException; /** * Fast, efficient map specifically for {@link ObjectId} subclasses. @@ -158,7 +159,7 @@ public V next() { return v; } } - throw new IllegalStateException(); + throw new NoSuchElementException(); } public void remove() {