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

Getting 'IllegalArgumentException: moduleLoader is null' when iterating modules and module.xml contains a permissions markup

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.10.0.Final
    • 1.8.6.Final
    • XML
    • None
    • Hide

      Attached a maven project as a reproducer. Download it, unzip and execute:
      java -jar ./target/lib/jboss-modules-1.8.6.Final.jar -mp target/classes/modules local.tests.module

      IAE is thrown.
      If you comment the permission section in the module.xml, the project is executed without problems

      Show
      Attached a maven project as a reproducer. Download it, unzip and execute: java -jar ./target/lib/jboss-modules-1.8.6.Final.jar -mp target/classes/modules local.tests.module IAE is thrown. If you comment the permission section in the module.xml, the project is executed without problems

      If we are executing the following code and there is a module.xml that contains a permission markup, we get an IllegalArgumentException: moduleLoader is null:

      Iterator<String> stringIterator = ml.iterateModules((String) null, true);
              while (stringIterator.hasNext()){
                  ...
              }
      

      The exception is:

      Exception in thread "main" java.lang.IllegalArgumentException: moduleLoader is null
              at org.jboss.modules.security.ModularPermissionFactory.<init>(ModularPermissionFactory.java:69)
              at org.jboss.modules.xml.ModuleXmlParser.expandName(ModuleXmlParser.java:1464)
              at org.jboss.modules.xml.ModuleXmlParser.parseGrant(ModuleXmlParser.java:1386)
              at org.jboss.modules.xml.ModuleXmlParser.parsePermissions(ModuleXmlParser.java:1352)
              at org.jboss.modules.xml.ModuleXmlParser.parseModuleContents(ModuleXmlParser.java:681)
              at org.jboss.modules.xml.ModuleXmlParser.parseDocument(ModuleXmlParser.java:440)
              at org.jboss.modules.xml.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:311)
              at org.jboss.modules.xml.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:269)
              at org.jboss.modules.LocalModuleFinder$3.hasNext(LocalModuleFinder.java:299)
              at org.jboss.modules.ModuleLoader$2.hasNext(ModuleLoader.java:345)
              at local.tests.Main.main(Main.java:12)
              at org.jboss.modules.Module.run(Module.java:352)
              at org.jboss.modules.Module.run(Module.java:320)
              at org.jboss.modules.Main.main(Main.java:593)
      

      It seems jboss modules is unable to parse a module.xml under those circustances and when we are iteraing over the available modules.

      Source of the problem could be LocalModuleFinder:299, where the moduleLoader argument for parseModuleXml() is explicitely set to null.

              ropalka Richard Opalka
              yborgess1@redhat.com Yeray Borges Santana
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: