]
Andrew Rubinger updated SHRINKWRAP-455:
---------------------------------------
Status: Resolved (was: Pull Request Sent)
Fix Version/s: 1.1.3
Resolution: Done
Upstream:
ConcurrentModificationException during delete on imported archive
-----------------------------------------------------------------
Key: SHRINKWRAP-455
URL:
https://issues.jboss.org/browse/SHRINKWRAP-455
Project: ShrinkWrap
Issue Type: Bug
Reporter: Michal Matloka
Assignee: Michal Matloka
Fix For: 1.1.3
Description from:
https://community.jboss.org/message/808603#808603
{noformat}
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)
{noformat}
I was able to reproduce this issue.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: