Uploaded image for project: 'HiveMind'
  1. HiveMind
  2. HIVEMIND-34

Invalid sub-module name is not reported but a NPE is thrown instead

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • framework
    • None

    Description

      If the sub-module descriptor name is spelt wrong in the hivemodule.sdl descriptor, the following error message is displayed:

      2004-07-30 10:18:08,533 ERROR org.apache.hivemind.impl.RegistryBuilder [error] Error: Unable to read descriptor file:/C:/forge/test/descriptor/META-INF/sbu-module.sdl: Error parsing file:/C:/forge/test/descriptor/META-INF/sbu-module.sdl: java.lang.NullPointerException
      org.apache.hivemind.ApplicationRuntimeException: Unable to read descriptor file:/C:/forge/test/descriptor/META-INF/sbu-module.sdl: Error parsing file:/C:/forge/test/descriptor/META-INF/sbu-module.sdl: java.lang.NullPointerException
      at org.apache.hivemind.parse.DescriptorParser.parse(DescriptorParser.java:1438)
      at org.apache.hivemind.impl.RegistryAssemblyImpl$QueuedModule.parse(RegistryAssemblyImpl.java:63)
      at org.apache.hivemind.impl.RegistryAssemblyImpl.parseNextQueued(RegistryAssemblyImpl.java:133)
      at org.apache.hivemind.impl.RegistryBuilder.processModule(RegistryBuilder.java:234)
      at org.apache.hivemind.impl.RegistryBuilder.processModulesResources(RegistryBuilder.java:208)
      at org.apache.hivemind.impl.RegistryBuilder.processModules(RegistryBuilder.java:179)
      at org.apache.hivemind.impl.RegistryBuilder.constructDefaultRegistry(RegistryBuilder.java:738)
      at Driver.main(Driver.java:15)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)

      This is not very clear as it doesn't indicate that the actually sub-module could not be located.

      The following patch to the descriptor parser logs an error and ignores the sub-module include.
      --------------------8<------------------------
      1129a1130,1135
      > if (subModuleDescriptor.getResourceURL() == null)
      >

      { > _errorHandler.error(LOG,ParseMessages.missingResource(subModuleDescriptor),getLocation(),null); > return; > }

      >
      --------------------8<------------------------

      This assumes the resource always returns null if the resource can not be openend (getResourceURL) as is the case now

      Attachments

        1. patch.zip
          19 kB
          Johan Oskarsson

        Activity

          People

            hlship Howard Lewis Ship
            johan Johan Oskarsson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: