Uploaded image for project: 'ShrinkWrap'
  1. ShrinkWrap
  2. SHRINKWRAP-431

Archive.merge is broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 1.1.1-alpha-2
    • 1.1.1-alpha-1
    • None
    • None

      Observed different behavior in Archive.merge depending upon the order in which archives were merged; the merged view has been incomplete.

      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

      and:

      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

      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:

                  // 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);
                          }
                      }
                  

              mmatloka Michal Matloka (Inactive)
              arubinge@redhat.com Andrew Rubinger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: