Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

[SHRINKWRAP-445] possibility to export uncompressed Zip archives #69

Open
wants to merge 3 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

mmatloka commented Mar 23, 2013

https://issues.jboss.org/browse/SHRINKWRAP-445

Usage

archive.as(ZipExporter.class).uncompressed().exportAsInputStream();

How about "setCompression(boolean)" with default to true? And a companion "isCompressionEnabled()".

Owner

mmatloka replied Mar 25, 2013

It feels a bit like it would be the first setXXX type method in SW API?:P

Owner

mmatloka replied Mar 25, 2013

maybe:

ZipExporter compressionEnabled(boolean)
ZipExporter compressionEnabled() // by default enabled
ZipExporter compressionDisabled()
boolean isCompressionEnabled()

So in practice it would look like this

webArchive.as(ZipExporter.class).compressionDisabled().exportTo(file1, true);

What do you think?

lowecg commented Mar 31, 2013

Hello,

Thank you for considering this functionality.

Is it possible to specify the default compression level using a system property/singleton?

In my use case, I do not wish shrinkwrap to compress what is produced by Arquillian. So to access the compression controls I'd have to produce a custom build of Arquillian. Or is that beyond the scope of this modification?

Regards,

Chris.

Contributor

mmatloka commented Mar 31, 2013

Hello Chris,

Probably it would be better to create next simply a feature request for Arquillian to allow defining compression in arquillian.xml . But after this pull request will be closed and the appropriate shrinkwrap version will be released.

Owner

ALRubinger commented Apr 18, 2013

Michal: Yes, your last proposal looks like the winner. "Make it so"." :)

Owner

ALRubinger commented Apr 18, 2013

Chris: In general we avoid the use of singletons and system properties as they made for JVM-wide settings, which are too coarsely-scoped (also they bypass the API entirely and aren't very intuitive). However, if you'd like to open a feature request for us to provide some mechanism to set the compression level rather than some on/off boolean, please feel free to open an JIRA and make your case.

Owner

ALRubinger commented Apr 18, 2013

I've put this into upstream/SHRINKWRAP-445.

Now failing on *nix system locally:

testExportUncompressedImportExport(org.jboss.shrinkwrap.impl.base.exporter.ZipExporterTestCase) Time elapsed: 0.038 sec <<< ERROR!
java.lang.InternalError: jzentry == 0,
jzfile = 1103971568,
total = 3,
name = target/testExportImportExport1.war,
i = 2,
message = invalid LOC header (bad signature)
at java.util.zip.ZipFile$3.nextElement(ZipFile.java:429)
at java.util.zip.ZipFile$3.nextElement(ZipFile.java:415)
at org.jboss.shrinkwrap.impl.base.importer.zip.ZipImporterImpl.importFrom(ZipImporterImpl.java:165)
at org.jboss.shrinkwrap.api.ArchiveFactory.createFromZipFile(ArchiveFactory.java:199)
at org.jboss.shrinkwrap.api.ShrinkWrap.createFromZipFile(ShrinkWrap.java:185)
at org.jboss.shrinkwrap.impl.base.exporter.ZipExporterTestCase.testExportUncompressedImportExport(ZipExporterTestCase.java:242)

Owner

ALRubinger commented Aug 7, 2013

Ping on this issue.

Contributor

mmatloka commented Aug 18, 2013

Rechecked - on windows still works. On ubuntu also it works!. Both with sun/oracle jdk 5 and 7 installed.

Owner

ALRubinger commented Aug 19, 2013

Hmm, fails with above error on:

mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 08:51:28-0500)
Maven home: /home/alr/opt/apache/maven/apache-maven-3.0.5
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /home/alr/opt/oracle/java/jdk1.7.0_25/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-19-generic", arch: "amd64", family: "unix"

Contributor

mmatloka commented Aug 19, 2013

Maybe @kpiwko you could check this to verify as a third person?:)

Owner

ALRubinger commented Aug 19, 2013

All it takes is a failure on one machine to be a failure. :)

I'll set up a CI job for this to see if we can get an authoritative example to share.

Contributor

mmatloka commented Aug 19, 2013

"All it takes is a failure on one machine to be a failure. :)" nah, its a can't reproduce type issue -> ignore ;))

Owner

ALRubinger commented Aug 19, 2013

Passes CI on CloudBees Hudson: https://shrinkwrap.ci.cloudbees.com/view/ShrinkWrap/job/ShrinkWrap_upstream-SHRINKWRAP-445/1/

Still failing locally for me when using various JDKs in the runtime (as set by JAVA5_HOME env var) - 5, 7, and 8.

Owner

ALRubinger commented Aug 19, 2013

The failing build I have locally and the passing one on Jenkins CI both using jdk1.5.0_22

Owner

ALRubinger commented Aug 19, 2013

File in question from failing system:

$ file impl-base/target/testExportImportExport1.war
impl-base/target/testExportImportExport1.war: Zip archive data, at least v2.0 to extract

Owner

ALRubinger commented Aug 19, 2013

"unzip" command works on failing system:

$ ls -laR
.:
total 12
drwxr-xr-x 3 alr alr 4096 Aug 19 14:53 .
drwxr-xr-x 14 alr alr 4096 Aug 19 14:53 ..
drwxr-xr-x 2 alr alr 4096 Aug 19 14:53 lib

./lib:
total 708
drwxr-xr-x 2 alr alr 4096 Aug 19 14:53 .
drwxr-xr-x 3 alr alr 4096 Aug 19 14:53 ..
-rw-r--r-- 1 alr alr 706710 Aug 19 14:51 hsqldb.jar

Owner

ALRubinger commented Aug 19, 2013

Works here in IntelliJ runner.

Owner

ALRubinger commented Aug 19, 2013

More odd: from my command-line, passes when I just run impl-base. Fails when run as part of the aggregator parent POM.

Owner

kpiwko commented Aug 21, 2013

@mmatloka Fails here, it seems the be the same problem as mentioned above.

java.lang.InternalError: jzentry == 0,
 jzfile = 1098732368,
 total = 3,
 name = target/testExportImportExport1.war,
 i = 2,
 message = invalid LOC header (bad signature)
    at java.util.zip.ZipFile$3.nextElement(ZipFile.java:429)
    at java.util.zip.ZipFile$3.nextElement(ZipFile.java:415)
    at org.jboss.shrinkwrap.impl.base.importer.zip.ZipImporterImpl.importFrom(ZipImporterImpl.java:165)
    at org.jboss.shrinkwrap.api.ArchiveFactory.createFromZipFile(ArchiveFactory.java:199)
    at org.jboss.shrinkwrap.api.ShrinkWrap.createFromZipFile(ShrinkWrap.java:185)
    at org.jboss.shrinkwrap.impl.base.exporter.ZipExporterTestCase.testExportUncompressedImportExport(ZipExporterTestCase.java:242)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:81)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Contributor

mmatloka commented Aug 21, 2013

@ALRubinger @kpiwko do you have the same linux distribution?

Owner

ALRubinger commented Aug 21, 2013

/me on Linux Mint based off Ubuntu Wheezy. But the important bit there id
Oracle JDKs for 5 6 7 and 8 all for *nix 64bit.

Owner

kpiwko commented Aug 21, 2013

RHEL 6.4 64bit, Oracle JDK 1.7.0_25

Owner

ALRubinger commented Aug 21, 2013

I'll try a 32bit JDK in the morning.

Contributor

mmatloka commented Aug 22, 2013

and how was it @ALRubinger ?

Owner

ALRubinger commented Aug 22, 2013

Same error.

Contributor

mmatloka commented Aug 22, 2013

what about OpenJDK e.g. ?

Contributor

mmatloka commented Jul 31, 2014

We have still this to solve ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment