avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leif Mortenson <l...@tanukisoftware.com>
Subject Fix in BucketMap
Date Thu, 07 Nov 2002 16:53:10 GMT
I had to apply a fix to the BucketMap class in collections.

Objects created by java.lang.reflect.Proxy return false you call
p.equals( p ) even
though they are the same object. This was causing gets to fail when they
were
used. The fix was to add equality comparisons ((p == p) || (p.equals(p)))

There was a thread a bit ago about moving collections over to Commons
and then deprecating
the one in Excalibur. Has this happened yet? If so, then this patch
needs to be applied to the
version in commons as well.

Cheers,
Leif

cvs diff -u BucketMap.java
Index: BucketMap.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/collections/src/java/org/apache/avalon/excalibur/collections/BucketMap.java,v
retrieving revision 1.23
diff -u -r1.23 BucketMap.java
--- BucketMap.java 8 Oct 2002 03:15:50 -0000 1.23
+++ BucketMap.java 7 Nov 2002 16:46:52 -0000
@@ -153,7 +153,7 @@
{
n = next;

- if( n.key.equals( key ) )
+ if( ( n.key == key ) || ( n.key.equals( key ) ) )
{
// do not adjust size because nothing was added
Object returnVal = n.value;
@@ -192,7 +192,7 @@

while( n != null && n.key != null )
{
- if( n.key.equals( key ) )
+ if( ( n.key == key ) || ( n.key.equals( key ) ) )
{
return n.value;
}
@@ -222,7 +222,7 @@

while( n != null && n.key != null )
{
- if( n.key.equals( key ) )
+ if( ( n.key == key ) || ( n.key.equals( key ) ) )
{
return true;
}
@@ -254,7 +254,7 @@

while( n != null && n.key != null )
{
- if( n.value.equals( value ) )
+ if( ( n.value == value ) || ( n.value.equals( value ) ) )
{
return true;
}
@@ -352,7 +352,7 @@

while( n != null && n.key != null )
{
- if( n.key.equals( key ) )
+ if( ( n.key == key ) || ( n.key.equals( key ) ) )
{
// Remove this node from the linked list of nodes.
if( null == prev )




--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message