Uploaded image for project: 'ShrinkWrap'
  1. ShrinkWrap
  2. SHRINKWRAP-474

getAsType fail if the ArchiveAsset exists

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.2.2
    • 1.2.1
    • impl-base
    • None

      Two issues with the current impl:

      1. the represented ArchivePath already exists as ArchiveAsset, so there is no need to attempt to import it
      2. it silently fail to delete the existing ArchivePath after import, so it throws exception when trying to overwrite the existing path.

      String path = "a.jar";
      ShrinkWrap.create(WebArchive.class)
      	.addAsLibraries(
      		ShrinkWrap.create(JavaArchive.class, path)
      			.add(EmptyAsset.INSTANCE, "something"))
      	.getAsType(
      			GenericArchive.class,
      			ArchivePaths.create("WEB-INF/lib", path),
      			ArchiveFormat.ZIP);
      
      org.jboss.shrinkwrap.api.IllegalOverwriteException: Cannot add requested asset org.jboss.shrinkwrap.api.asset.ArchiveAsset@49873ad9 to path /WEB-INF/lib/a.jar to archive 77b80d55-7637-4b87-9ac6-802aab489af3.war; path already exists as directory
      	at org.jboss.shrinkwrap.impl.base.MemoryMapArchiveBase.addAsset(MemoryMapArchiveBase.java:195)
      	at org.jboss.shrinkwrap.impl.base.MemoryMapArchiveBase.add(MemoryMapArchiveBase.java:127)
      	at org.jboss.shrinkwrap.impl.base.ArchiveBase.getAsType(ArchiveBase.java:305)
      	at org.jboss.shrinkwrap.impl.base.container.ContainerBase.getAsType(ContainerBase.java:467)
      

              arubinge@redhat.com Andrew Rubinger (Inactive)
              aslak@redhat.com Aslak Knutsen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: