Woops! forgot to remove some files. Thats fixed now.
Now, regarding your proposed patch, I just ran this test:
public class TEst {
public static void main(String[] args) {
System.out.println(new HashMap().values().iterator().hasNext());
System.out.println(new THashMap().values().iterator().hasNext());
System.out.println(new TreeMap().values().iterator().hasNext());
}
}
Which gave the results I expected. (Namely printed false three times, no
exception.) Exactly which implementation of Map are you using that returns
null from values()? I would put that result down to an incorrect
implementation of the Map interface.....
----- Original Message -----
From: "Mark Woon" <mor...@SM...>
To: "Hibernate Mailing List" <hib...@li...>
Sent: Tuesday, September 24, 2002 4:57 PM
Subject: [Hibernate] NPE in cirrus.hibernate.collections.Map
> Gavin,
>
> You've been busy! Unfortunately, CVS is is not compilable at the
> moment. Lots of errors about ambiguous references due to multiple
> classes with the same name.
>
> I'm also getting an NPE in cirrus.hibernate.collections.Map @ line 180
> when the collection is empty. A patch to fix this is attached.
>
> -Mark
>
----------------------------------------------------------------------------
----
> ? build
> ? patch.diff
> ? lib/j2ee.jar
> ? lib/junit.jar
> Index: cirrus/hibernate/collections/Map.java
> ===================================================================
> RCS file:
/cvsroot/hibernate/Hibernate/cirrus/hibernate/collections/Map.java,v
> retrieving revision 1.42
> diff -b -c -r1.42 Map.java
> *** cirrus/hibernate/collections/Map.java 11 Sep 2002 12:07:27 -0000 1.42
> --- cirrus/hibernate/collections/Map.java 24 Sep 2002 06:54:09 -0000
> ***************
> *** 9,14 ****
> --- 9,15 ----
> import java.util.Collection;
> import java.util.HashSet;
> import java.util.Iterator;
> + import java.util.ListIterator;
>
> import org.odmg.DMap;
>
> ***************
> *** 176,183 ****
> --- 177,188 ----
> * @see PersistentCollection#elements()
> */
> public Iterator elements() {
> + Collection col = map.values();
> + if (col != null) {
> return map.values().iterator();
> }
> + return new ListIterator();
> + }
> public boolean empty() {
> return map.isEmpty();
> }
>
|