[kaffe] CVS kaffe (dalibor): Fix for StackOverflowError in ant from CVS
Kaffe CVS
cvs-commits at kaffe.org
Sun Oct 5 11:28:02 PDT 2003
PatchSet 4100
Date: 2003/10/05 18:25:09
Author: dalibor
Branch: HEAD
Tag: (none)
Log:
Fix for StackOverflowError in ant from CVS
Fixed by delegating calls to Hashtable's contains and containsValue methods
to a private worker method to avoid crashes due to classes overriding both
methods in a way that results in an invocation loop.
Members:
ChangeLog:1.1695->1.1696
libraries/javalib/java/util/Hashtable.java:1.29->1.30
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1695 kaffe/ChangeLog:1.1696
--- kaffe/ChangeLog:1.1695 Sun Oct 5 17:06:57 2003
+++ kaffe/ChangeLog Sun Oct 5 18:25:09 2003
@@ -1,3 +1,11 @@
+2003-10-05 Dalibor Topic <robilad at kaffe.org>
+
+ * libraries/javalib/java/util/Hashtable.java:
+ (internalcontainsValue) new method.
+ (contains, containsValue) delegate to internalContainsValue.
+
+ Reported by: Jim Pick <jim at kaffe.org>
+
2003-10-05 Stuart Ballard <stuart.ballard at corp.fast.net>
* libraries/javalib/java/util/HashMap.java:
Index: kaffe/libraries/javalib/java/util/Hashtable.java
diff -u kaffe/libraries/javalib/java/util/Hashtable.java:1.29 kaffe/libraries/javalib/java/util/Hashtable.java:1.30
--- kaffe/libraries/javalib/java/util/Hashtable.java:1.29 Sun Oct 5 17:06:58 2003
+++ kaffe/libraries/javalib/java/util/Hashtable.java Sun Oct 5 18:25:11 2003
@@ -333,7 +333,10 @@
*/
public synchronized boolean contains(Object value)
{
- return containsValue(value);
+ /* delegate to non-overridable worker method
+ * to avoid blowing up the stack.
+ */
+ return internalContainsValue(value);
}
/**
@@ -349,6 +352,25 @@
* @since 1.2
*/
public boolean containsValue(Object value)
+ {
+ /* delegate to non-overridable worker method
+ * to avoid blowing up the stack.
+ */
+ return internalContainsValue(value);
+ }
+
+ /**
+ * Returns true if this Hashtable contains a value <code>o</code>, such that
+ * <code>o.equals(value)</code>. This is an internal worker method
+ * called by <code>contains()</code> and <code>containsValue()</code>.
+ *
+ * @param value the value to search for in this Hashtable
+ * @return true if at least one key maps to the value
+ * @see #contains(Object)
+ * @see #containsKey(Object)
+ * @throws NullPointerException if <code>value</code> is null
+ */
+ private boolean internalContainsValue(Object value)
{
for (int i = buckets.length - 1; i >= 0; i--)
{
More information about the kaffe
mailing list