crafterm 2002/06/27 09:10:49
Modified: collections/src/java/org/apache/avalon/excalibur/collections
BucketMap.java
Log:
Fixed threading issue.
If one thread executes (in remove()):
m_buckets[hash] = null;
while another thread executes (eg. in put()):
synchronized( m_buckets[hash] )
with the same object (ie hash index) then an NPE would occur.
Revision Changes Path
1.22 +2 -6
jakarta-avalon-excalibur/collections/src/java/org/apache/avalon/excalibur/collections/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.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- BucketMap.java 27 Jun 2002 01:22:13 -0000 1.21
+++ BucketMap.java 27 Jun 2002 16:10:49 -0000 1.22
@@ -356,11 +356,7 @@
if( null == prev )
{
// This node was the head, set the next node to be
the new head.
- m_buckets[ hash ] = n.next;
- if ( m_buckets[hash] == null )
- {
- m_buckets[hash] = new Node();
- }
+ m_buckets[ hash ] = ( n.next == null ? new Node() :
n.next );
}
else
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>