This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi, Here are a couple of patches from GNU Classpath 0.20 (and current trunk) that I think are good candidates for putting on the 4.1 branch. The are all small, have bug number associated with them and are (imho) unintrusive. Are they OK for the 4.1 branch? Cheers, Mark
2005-12-25 Jeroen Frijters <jeroen@frijters.net>
* java/util/Collections.java
(binarySearch(List,Object,Comparator)): Changed comparison order
for improved compatibility.
Index: java/util/Collections.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Collections.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- java/util/Collections.java 13 Sep 2005 22:19:15 -0000 1.38
+++ java/util/Collections.java 25 Dec 2005 11:06:38 -0000 1.39
@@ -670,10 +670,10 @@
for ( ; i != pos; i--, o = itr.previous());
forward = false;
}
- final int d = compare(key, o, c);
+ final int d = compare(o, key, c);
if (d == 0)
return pos;
- else if (d < 0)
+ else if (d > 0)
hi = pos - 1;
else
// This gets the insertion point right on the last loop
@@ -685,10 +685,10 @@
while (low <= hi)
{
pos = (low + hi) >> 1;
- final int d = compare(key, l.get(pos), c);
+ final int d = compare(l.get(pos), key, c);
if (d == 0)
return pos;
- else if (d < 0)
+ else if (d > 0)
hi = pos - 1;
else
// This gets the insertion point right on the last loop
2005-12-07 Ito Kazumitsu <kaz@maczuka.gcd.org>
Fixes bug #25273
* java/text/DecimalFormat.java(scanFormat): Don't set
minimumIntegerDigits to 0.
Index: java/text/DecimalFormat.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/DecimalFormat.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- java/text/DecimalFormat.java 2 Jul 2005 20:32:41 -0000 1.24
+++ java/text/DecimalFormat.java 7 Dec 2005 15:12:21 -0000 1.25
@@ -182,7 +182,9 @@
{
groupingUsed = saw_group;
groupingSize = (byte) countSinceGroup;
- minimumIntegerDigits = zeroCount;
+ // Checking "zeroCount > 0" avoids 0 being formatted into "" with "#".
+ if (zeroCount > 0)
+ minimumIntegerDigits = zeroCount;
}
// Early termination.
2006-01-10 Jeroen Frijters <jeroen@frijters.net>
PR classpath/25727
* java/util/Hashtable.java
(contains): Call equals on existing value.
(containsKey, get, put, remove): Call equals on existing key.
(getEntry): Call equals on existing entry.
===================================================================
RCS file: /var/lib/cvs/sources/classpath/classpath/java/util/Hashtable.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- classpath/classpath/java/util/Hashtable.java 2005/07/05 10:28:03 1.35
+++ classpath/classpath/java/util/Hashtable.java 2006/01/10 07:53:45 1.36
@@ -1,6 +1,7 @@
/* Hashtable.java -- a class providing a basic hashtable data structure,
mapping Object --> Object
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -333,20 +334,19 @@
*/
public synchronized boolean contains(Object value)
{
+ if (value == null)
+ throw new NullPointerException();
+
for (int i = buckets.length - 1; i >= 0; i--)
{
HashEntry e = buckets[i];
while (e != null)
{
- if (value.equals(e.value))
+ if (e.value.equals(value))
return true;
e = e.next;
}
}
-
- // Must throw on null argument even if the table is empty
- if (value == null)
- throw new NullPointerException();
return false;
}
@@ -385,7 +385,7 @@
HashEntry e = buckets[idx];
while (e != null)
{
- if (key.equals(e.key))
+ if (e.key.equals(key))
return true;
e = e.next;
}
@@ -408,7 +408,7 @@
HashEntry e = buckets[idx];
while (e != null)
{
- if (key.equals(e.key))
+ if (e.key.equals(key))
return e.value;
e = e.next;
}
@@ -438,7 +438,7 @@
while (e != null)
{
- if (key.equals(e.key))
+ if (e.key.equals(key))
{
// Bypass e.setValue, since we already know value is non-null.
Object r = e.value;
@@ -484,7 +484,7 @@
while (e != null)
{
- if (key.equals(e.key))
+ if (e.key.equals(key))
{
modCount++;
if (last == null)
@@ -844,7 +844,7 @@
HashEntry e = buckets[idx];
while (e != null)
{
- if (o.equals(e))
+ if (e.equals(o))
return e;
e = e.next;
}
2006-01-10 Jeroen Frijters <jeroen@frijters.net>
PR classpath/24618
* java/util/AbstractMap.java
(equals(Object,Object)): Test for identity first.
* java/util/WeakHashMap.java
(WeakBucket.WeakEntry.equals): Use helper method to determine equality.
(WeakBucket.WeakEntry.toString): Fixed string representation of
null key.
(internalGet): Use helper method to determine equality.
===================================================================
RCS file: /var/lib/cvs/sources/classpath/classpath/java/util/AbstractMap.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- classpath/classpath/java/util/AbstractMap.java 2005/07/02 20:32:41 1.29
+++ classpath/classpath/java/util/AbstractMap.java 2006/01/10 07:26:04 1.30
@@ -594,13 +594,13 @@
*
* @param o1 the first object
* @param o2 the second object
- * @return o1 == null ? o2 == null : o1.equals(o2)
+ * @return o1 == o2 || (o1 != null && o1.equals(o2))
*/
// Package visible for use throughout java.util.
// It may be inlined since it is final.
static final boolean equals(Object o1, Object o2)
{
- return o1 == null ? o2 == null : o1.equals(o2);
+ return o1 == o2 || (o1 != null && o1.equals(o2));
}
/**
===================================================================
RCS file: /var/lib/cvs/sources/classpath/classpath/java/util/WeakHashMap.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- classpath/classpath/java/util/WeakHashMap.java 2005/11/09 22:51:54 1.20
+++ classpath/classpath/java/util/WeakHashMap.java 2006/01/10 07:26:04 1.21
@@ -475,7 +475,7 @@
if (o instanceof Map.Entry)
{
Map.Entry e = (Map.Entry) o;
- return key.equals(e.getKey())
+ return WeakHashMap.equals(getKey(), e.getKey())
&& WeakHashMap.equals(value, e.getValue());
}
return false;
@@ -483,7 +483,7 @@
public String toString()
{
- return key + "=" + value;
+ return getKey() + "=" + value;
}
}
@@ -657,7 +657,7 @@
while (bucket != null)
{
WeakBucket.WeakEntry entry = bucket.getEntry();
- if (entry != null && key.equals(entry.key))
+ if (entry != null && equals(key, entry.key))
return entry;
bucket = bucket.next;
2005-12-04 Guilhem Lavaux <guilhem@kaffe.org>
* java/net/URL.java (URL): Check whether context is null before
accessing ph.
2005-11-29 Tom Tromey <tromey@redhat.com>
PR classpath/25141:
* java/net/URL.java (URL): Use context's stream handler.
Index: java/net/URL.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URL.java,v
retrieving revision 1.49
retrieving revision 1.51
diff -u -r1.49 -r1.51
--- java/net/URL.java 17 Nov 2005 10:58:47 -0000 1.49
+++ java/net/URL.java 4 Dec 2005 20:52:47 -0000 1.51
@@ -342,7 +342,7 @@
*/
public URL(URL context, String spec) throws MalformedURLException
{
- this(context, spec, (URLStreamHandler) null);
+ this(context, spec, (context == null) ? (URLStreamHandler)null : context.ph);
}
/**
Attachment:
signature.asc
Description: This is a digitally signed message part
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |