You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Bart Selders <ba...@ibanx.nl> on 2003/03/29 23:44:55 UTC

Bug in 2.3-HEAD: ConcurrentModificationException thrown by DynamicURI: ArrayList implementation not threadsafe

Hi,

In 2.3 HEAD I get a ConcurrentModificationException exception when 
removing parameter data from DynamicURI. Current DynamicURI (1.16) uses 
an ArrayList for pathInfo & queryString. Before version 1.11 a Vector 
was used. ArrayList is not threadsafe.

Stacktrace from my log file:

2003-03-29 21:08:43,864 ERROR org.apache.turbine.util.DynamicURI - Could 
not remove showAs
java.util.ConcurrentModificationException
	at 
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:444)
	at java.util.AbstractList$Itr.next(AbstractList.java:421)
	at org.apache.turbine.util.DynamicURI.remove(DynamicURI.java:668)
	at org.apache.turbine.util.DynamicURI.removePathInfo(DynamicURI.java:725)
	at ibanx.turbine.tools.LinkTool.setPathInfo(LinkTool.java:259)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)


Snippet from ArrayList Javadoc:
<snip>
Note that this implementation is not synchronized. If multiple threads 
access an ArrayList instance concurrently, and at least one of the 
threads modifies the list structurally, it must be synchronized 
externally. (A structural modification is any operation that adds or 
deletes one or more elements, or explicitly resizes the backing array; 
merely setting the value of an element is not a structural modification.)
</snip>

One way to reproduce this behaviour is by using the following snippet in 
a velocity template:

    $link.addPathInfo("test","x").removePathInfo("test")

An exception is thrown in the logfile.

Bart



*************************************************************************
The information contained in this communication is confidential and is
intended solely for the use of the individual or entity to  whom it is
addressed.You should not copy, disclose or distribute this communication 
without the authority of iBanx bv. iBanx bv is neither liable for 
the proper and complete transmission of the information has been maintained
nor that the communication is free of viruses, interceptions or interference.

If you are not the intended recipient of this communication please return
the communication to the sender and delete and destroy all copies.

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org