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

Empty Directory Causes FileNotFoundException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.0.0-beta-6
    • 1.0.0-beta-5
    • impl-base
    • None
    • Hide

      @Test
      public void shouldBeAbleToAddEmptyDirectory()
      throws Exception

      { File resources = File.createTempFile("resources", null); resources.delete(); File svn = new File(resources, ".svn"); svn.mkdirs(); ShrinkWrap.create(JavaArchive.class) .addAsResource(resources, "/") .as(ZipExporter.class) .exportTo(new ByteArrayOutputStream()); }
      Show
      @Test public void shouldBeAbleToAddEmptyDirectory() throws Exception { File resources = File.createTempFile("resources", null); resources.delete(); File svn = new File(resources, ".svn"); svn.mkdirs(); ShrinkWrap.create(JavaArchive.class) .addAsResource(resources, "/") .as(ZipExporter.class) .exportTo(new ByteArrayOutputStream()); }

    Description

      Adding an empty directory as a resource to an archive causes a FileNotFoundException when exporting the archive.

      Looking at ContainerBase, it appears as though it is using file.listFiles() == 0 instead of isFile() or isDirectory()

      org.jboss.shrinkwrap.impl.base.container.ContainerBase.addAsResource(File resource, ArchivePath target)
      {
      ...
      if (files.length == 0)
      return addAsResource(new FileAsset(resource), target);

      Attachments

        Activity

          People

            tahintz_jira Tom Hintz (Inactive)
            tahintz_jira Tom Hintz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: