ShrinkWrap
  1. ShrinkWrap
  2. SHRINKWRAP-474

getAsType fail if the ArchiveAsset exists

    Details

    • Type: Bug Bug
    • Status: Resolved (View Workflow)
    • Priority: Major Major
    • Resolution: Done
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.2.2
    • Component/s: impl-base
    • Labels:
      None
    • Similar Issues:
      Show 10 results 

      Description

      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)
      

        Gliffy Diagrams

          Issue Links

            Activity

            Show
            Andrew Rubinger added a comment - Upstream: https://github.com/shrinkwrap/shrinkwrap/commit/d867112e5f3c111fff4b995b506b9c78b7f419ae

              People

              • Assignee:
                Andrew Rubinger
                Reporter:
                Aslak Knutsen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development