Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2254

FileSystemBeanArchiveHandler does not handle nested directories in uber jars

    Details

      Description

      For a variety of reasons, I have a nested bean archive available in my jar file under FOOBAR/classes. This means there is a FOOBAR/classes/META-INF/beans.xml file in there.

      Weld SE properly finds the beans.xml there, but when the FileSystemBeanArchiveHandler class goes to do things with it, it is skipped due to a trailing slash equality comparison issue.

      In FileSystemBeanArchiveHandler.java, line 125 and following, it reads:

             try (ZipFile zip = new ZipFile(file)) {
       
                  Enumeration<? extends ZipEntry> entries = zip.entries();
       
                  while (entries.hasMoreElements()) {
       
                      ZipEntry zipEntry = entries.nextElement();
       
                      if (zipEntry.getName().equals(nestedEntryName)) { // XXXX <--- this is the problem
      
      

      At line 133 (marked with // XXXX above), the zipEntry's name will (in my case) end with a trailing slash, whereas the nestedEntryName will not end with a trailing slash. This means that only nested jar files, not nested archive directory roots, can be detected.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mkouba Martin Kouba
                Reporter:
                ljnelson Laird Nelson
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: