Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-849

StringIndexOutOfBoundsException in readFromJar

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 6.3.0.CR1
    • 6.2.0.Final
    • core engine
    • None

    Description

      I am trying to get a small app of the ground which loads a number of KieModules from jar files. I found that in cases where the jar contains a file in the jar's root directory a SIOOBE is raised as follows:

      I have run into what may be the same issue trying to get a small application up with a separate jar for my module. The NPE I found was thrown as follows:
      Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.lang.String.substring(String.java:1911)
      at org.drools.compiler.compiler.io.memory.MemoryFileSystem.readFromJar(MemoryFileSystem.java:457)
      at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieBuilder(KieServicesImpl.java:105)
      at com.siemens.systematics.configurator.ConfiguratorMain.loadModule(ConfiguratorMain.java:59)
      at com.siemens.systematics.configurator.ConfiguratorMain.loadModules(ConfiguratorMain.java:54)
      at com.siemens.systematics.configurator.ConfiguratorMain.main(ConfiguratorMain.java:32)

      This is caused by entry.getName().lastIndexOf('/') returning -1 for (in my case) a name of "rules.drl". The module itself was created using the 6.2.0Final maven archetype so it seems like this should be a common occurrence. I did find one users' report of this issue on a forum from 2013.

      A workaround appears to be just to ensure that the rules.drl file is not in the root directory.

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            benjamin.carlyle Benjamin Carlyle (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: