[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-431) Archive.merge is broken

Michal Matloka (JIRA) jira-events at lists.jboss.org
Sat Nov 3 09:58:18 EDT 2012


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

Michal Matloka edited comment on SHRINKWRAP-431 at 11/3/12 9:56 AM:
--------------------------------------------------------------------

Really introduced by SHRINKWRAP-389. When directory 'a' with file 'b.txt' were overwritten by 'a' with 'a.txt', sometimes (depends on order of assets, sometimes dir is first), dir 'a' gets overwritten with empty new dir 'a', to which file 'b.txt' is being added. Assets were added properly to 'content', but tree was constructed improperly.
                
      was (Author: mmatloka):
    Really introduced by SHRINKWRAP-389. When directory 'a' with file 'b.txt' were overwritten by 'a' with 'a.txt', sometimes (depends on order of assets, sometimes dir is first), dir 'a' gets overwritten with empty new dir 'a', to which file 'b.txt' is being added. Assets were added properly, but tree was constructed improperly.
                  
> Archive.merge is broken
> -----------------------
>
>                 Key: SHRINKWRAP-431
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-431
>             Project: ShrinkWrap
>          Issue Type: Bug
>    Affects Versions: 1.1.1-alpha-1
>            Reporter: Andrew Rubinger
>            Assignee: Michal Matloka
>            Priority: Blocker
>             Fix For: 1.1.1
>
>
> Observed different behavior in Archive.merge depending upon the order in which archives were merged; the merged view has been incomplete.
> {code}Nov 01, 2012 3:20:26 PM org.jboss.arquillian.daemon.server.NettyServer start
> INFO: Server started on localhost:12345
> Nov 01, 2012 3:20:26 PM org.jboss.arquillian.daemon.protocol.arquillian.DaemonDeploymentPackager generateDeployment
> INFO: arquillian-junit.jar: 259 assets
> Nov 01, 2012 3:20:26 PM org.jboss.arquillian.daemon.protocol.arquillian.DaemonDeploymentPackager generateDeployment
> INFO: arquillian-core.jar: 495 assets
> Nov 01, 2012 3:20:26 PM org.jboss.arquillian.daemon.protocol.arquillian.DaemonDeploymentPackager generateDeployment
> INFO: Returning: f98cada5-136a-45bc-b233-d8fb97cb1994.jar: 756 assets
> Nov 01, 2012 3:20:27 PM org.jboss.arquillian.daemon.server.NettyServer$ActionControllerHandler inboundBufferUpdated
> INFO: Readable bytes: 142205
> Nov 01, 2012 3:20:27 PM org.jboss.arquillian.daemon.server.NettyServer$DeployHandlerAdapter inboundBufferUpdated
> INFO: Readable bytes received: 142205{code}
> and:
> {code}Nov 01, 2012 3:24:10 PM org.jboss.arquillian.daemon.server.NettyServer start
> INFO: Server started on localhost:12345
> Nov 01, 2012 3:24:11 PM org.jboss.arquillian.daemon.protocol.arquillian.DaemonDeploymentPackager generateDeployment
> INFO: arquillian-core.jar: 495 assets
> Nov 01, 2012 3:24:11 PM org.jboss.arquillian.daemon.protocol.arquillian.DaemonDeploymentPackager generateDeployment
> INFO: arquillian-junit.jar: 259 assets
> Nov 01, 2012 3:24:11 PM org.jboss.arquillian.daemon.protocol.arquillian.DaemonDeploymentPackager generateDeployment
> INFO: Returning: cad149cf-f4a8-472c-bb07-a5a7f5225ed3.jar: 756 assets
> Nov 01, 2012 3:24:11 PM org.jboss.arquillian.daemon.server.NettyServer$ActionControllerHandler inboundBufferUpdated
> INFO: Readable bytes: 277001
> Nov 01, 2012 3:24:11 PM org.jboss.arquillian.daemon.server.NettyServer$DeployHandlerAdapter inboundBufferUpdated
> INFO: Readable bytes received: 277001
> Nov 01, 2012 3:24:11 PM org.jboss.arquillian.daemon.server.NettyServer$DeployHandlerAdapter inboundBufferUpdated
> INFO: Deployed: 78178897-e394-45a1-b9d4-b465c145560a.jar: 259 assets{code}
> Though each report 756 assets, the file size of the exported view is different.  I suspect that directories are being written without content?
> Using the following manual code, all works as expected:
> {code}            // TODO THIS IS BROKEN IN SHRINKWRAP, FIX IT
>             // archive.merge(auxArchive);
>             
>             //TODO This hack replaces the above.
>             final Map<ArchivePath, Node> content = auxArchive.getContent();
>             final Collection<ArchivePath> paths = content.keySet();
>             for (final ArchivePath path : paths) {
>                 final Node current = archive.get(path);
>                 final Node aux = content.get(path);
>                 if (current != null) {
>                     if (current.getAsset() == null && aux.getAsset() == null) {
>                     } else if (current.getAsset() == null && aux.getAsset() != null) {
>                         throw new IllegalStateException("Current archive has dir and aux has " + aux.getAsset()
>                             + " at " + path);
>                     } else if (current.getAsset() != null && aux.getAsset() == null) {
>                         throw new IllegalStateException("Current archive has " + current.getAsset()
>                             + " and aux has dir at " + path);
>                     } else {
>                         archive.add(aux.getAsset(), path);
>                     }
>                 } else {
>                     if (aux.getAsset() != null) {
>                         archive.add(aux.getAsset(), path);
>                     }
>                 }
>             {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


More information about the shrinkwrap-issues mailing list