Uploaded image for project: 'JBoss Modules'
  1. JBoss Modules
  2. MODULES-108

Package META-INF options always read from first jar instead of container jar

    Details

    • Steps to Reproduce:
      Hide

      You can notice the consequence of this using a jar having sealed modules in a package. This can cause all modules of the package being sealed.
      This is the case with the Open Office library.

      Please see this message http://community.jboss.org/message/629281#629281 to see how create a such module and notice the error.

      Show
      You can notice the consequence of this using a jar having sealed modules in a package. This can cause all modules of the package being sealed. This is the case with the Open Office library. Please see this message http://community.jboss.org/message/629281#629281 to see how create a such module and notice the error.

      Description

      In org.jboss.modules.ModuleClassLoader.defineClass(String, ClassSpec)

      The following code is not correct:

      PackageSpec spec = null;
      for (ResourceLoader loader : loaders) {
         try {
            spec = loader.getPackageSpec(packageName);
            if (spec != null) {
               break;
            }
         } catch (IOException e) {
            // skip
         }
      }
      

      because actually the getPackageSpec() method never returns null.
      So, if a package is declared in a later jar in the loaders list, the package spec will be loaded with the default options of the first jar of the list, instead of the option of the container jar of the package.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                dmlloyd David Lloyd
                Reporter:
                guinotphil Philippe Guinot
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: