[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-455) ConcurrentModificationException during delete on imported archive

Michal Matloka (JIRA) jira-events at lists.jboss.org
Thu Apr 18 14:35:53 EDT 2013


     [ https://issues.jboss.org/browse/SHRINKWRAP-455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michal Matloka updated SHRINKWRAP-455:
--------------------------------------

              Status: Pull Request Sent  (was: Open)
    Git Pull Request: https://github.com/shrinkwrap/shrinkwrap/pull/74

    
> 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
>
> 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: http://www.atlassian.com/software/jira


More information about the shrinkwrap-issues mailing list