StringIndexOutOfBoundsException when a fact is in default package
-----------------------------------------------------------------
Key: JBRULES-2316
URL:
https://jira.jboss.org/jira/browse/JBRULES-2316
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 4.0.7
Reporter: Renaud Julienne
Assignee: Mark Proctor
Assuming you have a rule base for which you have defined shadow proxy excludes.
If you insert a fact which class is in default package, a StringIndexOutOfBoundsException
is raised by RuleBaseConfiguration#isShadowed()
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1768)
at org.drools.RuleBaseConfiguration.isShadowed(RuleBaseConfiguration.java:546)
at org.drools.reteoo.Rete$ClassObjectTypeConf.defineShadowProxyData(Rete.java:486)
at org.drools.reteoo.Rete$ClassObjectTypeConf.<init>(Rete.java:468)
at org.drools.reteoo.Rete.assertObject(Rete.java:152)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:704)
..........
Problem comes from this line (RuleBaseConfiguration.java:546):
String qualifiedNamespace = className.substring( 0,
className.lastIndexOf(
'.' ) ).trim(); // => default package => no '.' => exception
This can typically happen when trying to insert JDKProxies into the working memory for
test purpose (EasyMock use such proxies).
The issue only appears if you have defined shadow proxy excludes.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira