3 Replies Latest reply: Aug 3, 2010 8:57 AM by Andrew Rubinger RSS

Reopen this one?: SHRINKWRAP-93: ZipExporter should throw exception for empty archives

Michael Schuetz Novice

Hi to all,

 

I do use JDK1.6, GateIn3.1/JBossAS5.1, Arquillian Alpha3 (with Shrinkwrap Alpha11)

 

{code}

@Deployment
    public static Archive<?> getTestArchive() {
        final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war");
        final JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, "test.jar")
                .addClasses(MyService.class, MyServiceBean.class);
        final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class,
                "test.ear")
                .setApplicationXML("application.xml")
                .addModule(war)
                .addModule(ejb);

 

        log.info(ear.toString(true));
        return ear;
    }

{code}

 

application.xml:

{code}

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
   version="5">
   <module>
      <web>
         <web-uri>test.war</web-uri>
         <context-root>/test</context-root>
      </web>
   </module>
   <module>
      <ejb>test.jar</ejb>
   </module>
</application>

{code}

 

With an empty WAR archive i get:

java.lang.IllegalArgumentException: [SHRINKWRAP-93] Cannot use this JDK-based implementation to export as ZIP an archive with no content: test.war: 0 assets
        at org.jboss.shrinkwrap.impl.base.exporter.JdkZipExporterDelegate.<init>(JdkZipExporterDelegate.java:108)
        at org.jboss.shrinkwrap.impl.base.exporter.ZipExporterImpl.exportZip(ZipExporterImpl.java:95)
        at org.jboss.shrinkwrap.impl.base.exporter.ZipArchiveInputStreamFactory.doGetInputStream(ZipArchiveInputStreamFactory.java:48)
        at org.jboss.shrinkwrap.impl.base.ArchiveInputStreamFactory.getInputStream(ArchiveInputStreamFactory.java:60)

 

 

AFAIK, https://jira.jboss.org/browse/SHRINKWRAP-93 addresses this and was fixed for Alpha 4.

So, is it a bug or just a not supported feature? (-:

 

 

Thanks and regards

Michael