-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
None
Description from: https://community.jboss.org/message/808603#808603
I'm trying to use Shrinkwrap to delete a folder in a JavaArchive (jar). My jar is quite simple, it contains only one folder named resources and this folder contains two files : myJavaArchive.jar: /resources/ /resources/bar.txt /resources/foo.txt So I create a JavaArchive from my JAR file and I call delete method on "/resources" folder (see below) but it causes a ConcurrentModifictionException. My code : package com.test; import java.io.File; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; public class Main { public static void main(String[] args) { JavaArchive archive = ShrinkWrap.createFromZipFile(JavaArchive.class, new File(Main.class.getResource("/myJavaArchive.jar").getFile())); System.out.println(archive.toString(true)); archive.delete("/resources"); } } The stack trace : Exception in thread "main" java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at java.util.Collections$UnmodifiableCollection$1.next(Collections.java:1010) at org.jboss.shrinkwrap.impl.base.MemoryMapArchiveBase.removeNodeRecursively(MemoryMapArchiveBase.java:309) at org.jboss.shrinkwrap.impl.base.MemoryMapArchiveBase.delete(MemoryMapArchiveBase.java:291) at org.jboss.shrinkwrap.impl.base.MemoryMapArchiveBase.delete(MemoryMapArchiveBase.java:325) at org.jboss.shrinkwrap.impl.base.container.ContainerBase.delete(ContainerBase.java:393) at com.test.Main.main(Main.java:13)
I was able to reproduce this issue.