[jboss-jira] [JBoss JIRA] (DROOLS-849) StringIndexOutOfBoundsException in readFromJar

Benjamin Carlyle (JIRA) issues at jboss.org
Thu Jul 16 04:52:02 EDT 2015


Benjamin Carlyle created DROOLS-849:
---------------------------------------

             Summary: StringIndexOutOfBoundsException in readFromJar
                 Key: DROOLS-849
                 URL: https://issues.jboss.org/browse/DROOLS-849
             Project: Drools
          Issue Type: Bug
          Components: core engine
    Affects Versions: 6.2.0.Final
         Environment: Ubuntu, Netbeans, openjdk-7, maven
            Reporter: Benjamin Carlyle
            Assignee: Mario Fusco


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.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the jboss-jira mailing list