Code causing NPE on IBM JRE fixed. (see http://mdr.netbeans.org/servlets/ReadMsg?list=users&msgNo=3042)
1.1 --- a/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/MDRCache.java Fri May 20 16:43:50 2005 +0000
1.2 +++ b/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/MDRCache.java Mon May 23 21:36:53 2005 +0000
1.3 @@ -438,12 +438,10 @@
1.4
1.5 private static final Comparator mofidComparator = new Comparator() {
1.6 public int compare(Object o1, Object o2) {
1.7 - Map.Entry e1=(Map.Entry)o1;
1.8 - Map.Entry e2=(Map.Entry)o2;
1.9 - MOFID id1=(MOFID)e1.getKey();
1.10 - MOFID id2=(MOFID)e2.getKey();
1.11 + MOFID id1=(MOFID) o1;
1.12 + MOFID id2=(MOFID) o2;
1.13
1.14 - return (int)(id1.getSerialNumber()-id2.getSerialNumber());
1.15 + return (int)(id1.getSerialNumber() - id2.getSerialNumber());
1.16 }
1.17 };
1.18
1.19 @@ -451,19 +449,19 @@
1.20 * @return the keys of the new objects
1.21 */
1.22 public synchronized Collection getNew() {
1.23 - Collection result = new TreeSet(mofidComparator);
1.24 - result.addAll(newOnes.entrySet());
1.25 + Map result = new TreeMap(mofidComparator);
1.26 + result.putAll(newOnes);
1.27 newOnes.clear();
1.28 - return result;
1.29 + return result.entrySet();
1.30 }
1.31
1.32 /** Get all of the dirty objects
1.33 * @return the keys of the dirty objects
1.34 */
1.35 public synchronized Collection getDirty() {
1.36 - ArrayList result = new ArrayList(dirty.entrySet());
1.37 + HashMap result = new HashMap(dirty);
1.38 dirty.clear();
1.39 - return result;
1.40 + return result.entrySet();
1.41 }
1.42
1.43 /** Get all of the deleted IDs