[JBoss JIRA] (SHRINKWRAP-474) getAsType fail if the ArchiveAsset exists
by Aslak Knutsen (JIRA)
Aslak Knutsen created SHRINKWRAP-474:
----------------------------------------
Summary: getAsType fail if the ArchiveAsset exists
Key: SHRINKWRAP-474
URL: https://issues.jboss.org/browse/SHRINKWRAP-474
Project: ShrinkWrap
Issue Type: Bug
Components: impl-base
Affects Versions: 1.2.1
Reporter: Aslak Knutsen
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.
{code}
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);
{code}
{code}
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)
{code}
--
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
10 years, 2 months