[shrinkwrap-issues] [JBoss JIRA] (SHRINKRES-259) Shrinkwrap resolver generates invalid Zips

Florian Besser (JIRA) issues at jboss.org
Wed Dec 14 03:10:01 EST 2016


    [ https://issues.jboss.org/browse/SHRINKRES-259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13338259#comment-13338259 ] 

Florian Besser commented on SHRINKRES-259:
------------------------------------------

Sure thing:
https://github.com/shrinkwrap/resolver/pull/106

If you would like to verify the change: Check out the additional tests provided with my pull request. They will try to unpack the generated zip file, and assert that no exception is thrown. You could set a breakpoint before unzipping, and trying to unzip the generated file manually (I used 7zip). With the pull request it should work, while without the pull request you should get errors.

Please note that the integrated zip thingy in Windows ignores the errors, so I found it necessary to use an 3rd party tool.

> Shrinkwrap resolver generates invalid Zips
> ------------------------------------------
>
>                 Key: SHRINKRES-259
>                 URL: https://issues.jboss.org/browse/SHRINKRES-259
>             Project: ShrinkWrap Resolvers
>          Issue Type: Bug
>    Affects Versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4
>            Reporter: Florian Besser
>
> Affects shrinkwrap-resolver-impl-maven:2.2.0 up to shrinkwrap-resolver-impl-maven:2.2.4
> The class MavenResolvedArtifactImpl.java generates a zip File using the function packageDirectories.
> zipFiles generated by this method contain 1 zipfile entry per file (this is good) *but also 1 entry per _directory_*. This means that wildfly will throw a FileNotFoundException like the following:
> {code:java}
> 14:17:41,203 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."rdp-pricedata-testing.ear".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."X-Y-Z.ear".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "X-Y-Z.ear"
> ...
> Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0054: Failed to process children for EAR ["/C:/Daten/tools/wildfly-10.1.0.Final/bin/content/X-Y-Z.ear"]
> ...
> Caused by: java.io.FileNotFoundException: C:\Daten\tools\wildfly-10.1.0.Final\standalone\tmp\vfs\deployment\deployment8c1b4b7ccf088d0f\X-Y-other.war-1968e3b71e5fa852\com\sixgroup (The system cannot find the path specified)
> 	at java.io.FileOutputStream.open0(Native Method)
> 	at java.io.FileOutputStream.open(FileOutputStream.java:270)
> 	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
> 	at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
> 	at org.jboss.vfs.VFSUtils.unzip(VFSUtils.java:899)
> 	at org.jboss.vfs.VFS.mountZipExpanded(VFS.java:504)
> 	at org.jboss.vfs.VFS.mountZipExpanded(VFS.java:533)
> 	at org.jboss.as.ee.structure.EarStructureProcessor.mount(EarStructureProcessor.java:252)
> 	at org.jboss.as.ee.structure.EarStructureProcessor.createResourceRoot(EarStructureProcessor.java:271)
> 	at org.jboss.as.ee.structure.EarStructureProcessor.deploy(EarStructureProcessor.java:202)
> 	... 6 more
> {code}
> I'd suggest amending the code:
> {code:java}
> if (fileEntry.isDirectory()) {
>     zipFile.putNextEntry(new ZipEntry(entry));
> }
> {code}
> to:
> {code:java}
> if (fileEntry.isDirectory()) {
>     continue;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the shrinkwrap-issues mailing list