Hi!
I posted the problem recently and actually got it working - until now. For
some mysterious reason it suddenly does throw an
ConcurrentModifcationException in my Visitor (second for loop):
class Foo
{
private static final class HeisetextLegacyVisitor extends VisitorSupport
{
private static final String HEISETEXT = "heisetext";
public void visit( Element node )
{
if( node.getName().equalsIgnoreCase( HEISETEXT ) )
{
int index = -1;
// hard to touch the tip of your nose when you are
wankered...
List<Element> l = node.getParent().elements();
for( int i = 0; i < l.size(); i++ )
{
if ( l.get( i ).getName().equalsIgnoreCase(
HEISETEXT ) )
{
index=i;
break;
}
}
assert index != -1;
for ( Iterator<Element> it = node.elementIterator();
it.hasNext(); )
// HERE's where the exception is thrown
l.add( index++, (Element)it.next().detach() );
l.remove( index ); // heisetext
}
}
}
private static final Visitor LEGACY = new HeisetextLegacyVisitor();
public void go()
{
dom.accept( LEGACY );
}
}
Does anybody see why this exception is thrown here?
[java] java.util.ConcurrentModificationException
[java] at
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449)
[java] at java.util.AbstractList$Itr.next(AbstractList.java:420)
[java] at
org.dom4j.tree.FilterIterator.findNext(FilterIterator.java:70)
[java] at org.dom4j.tree.FilterIterator.next(FilterIterator.java:45)
[java] at Foo$HeisetextLegacyVisitor.visit
Timo
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user