------- Comment #1 from mckinlay at redhat dot com  2006-04-04 19:52 -------
I couldn't reproduce this when installing Subclipse, but after installing it
and subsequently trying to disable it, I reproducably get the following crash:

java.util.ConcurrentModificationException.ConcurrentModificationException()
([EMAIL PROTECTED])
    at
../../../libjava/classpath/java/util/ConcurrentModificationException.java:80
80        {
(gdb) bt
#0  java.util.ConcurrentModificationException.ConcurrentModificationException()
    ([EMAIL PROTECTED])
    at
../../../libjava/classpath/java/util/ConcurrentModificationException.java:80
#1  0x0349ded2 in java.util.HashMap$HashIterator.hasNext() ([EMAIL PROTECTED])
    at ../../../libjava/classpath/java/util/HashMap.java:856
#2  0x01efadb8 in
org::eclipse::update::internal::model::ConfigurationPolicyModel::remove () from
/usr/lib/gcj/eclipse/org.eclipse.update.core_3.1.2.jar.so
#3  0x01efb2df in
org::eclipse::update::internal::model::ConfigurationPolicyModel::addUnconfiguredFeatureReference
()
   from /usr/lib/gcj/eclipse/org.eclipse.update.core_3.1.2.jar.so
#4  0x01ec56bb in
org::eclipse::update::internal::core::ConfigurationPolicy::unconfigure () from
/usr/lib/gcj/eclipse/org.eclipse.update.core_3.1.2.jar.so


The relevent Eclipse code is: 
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.update.core/src/org/eclipse/update/internal/model/ConfigurationPolicyModel.java?rev=1.25&content-type=text/vnd.viewcvs-markup

        /**
         * 
         */
        private boolean remove(FeatureReferenceModel feature, Map list) {
                URL featureURL = feature.getURL();
                boolean found = false;
                Iterator iter = list.keySet().iterator();
                while (iter.hasNext() && !found) {
                        FeatureReferenceModel element = (FeatureReferenceModel)
iter.next();
                        if
(UpdateManagerUtils.sameURL(element.getURL(),featureURL)) {
                                list.remove(element);
                                found = true;
                        }
                }
                return found;
        }

This code is buggy: it is directly modifying an underlying collection (list)
while an iterator on that collection (iter) is active. This is not allowed
according to the J2SE documentation: 

"The iterators returned by all of this class's "collection view methods" are
fail-fast: if the map is structurally modified at any time after the iterator
is created, in any way except through the iterator's own remove or add methods,
the iterator will throw a ConcurrentModificationException. "

If this code works on Sun's implementation, then it would appear that Sun's
implementation does not conform with their own spec.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028

Reply via email to