[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2574) ArrayIndexOutOfBoundsException in ReteooRuleBase.addPackage() in 5.1.0.M2
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Sun Jul 11 11:55:46 EDT 2010
[ https://jira.jboss.org/browse/JBRULES-2574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12538701#action_12538701 ]
Mark Proctor commented on JBRULES-2574:
---------------------------------------
We initialise the row to -1, yet still do a lookup on that -1, hence the exception.
{code}
public FieldIndexHashTableFullIterator(final AbstractHashTable hashTable) {
this.hashTable = hashTable;
this.row = -1;
}
/* (non-Javadoc)
* @see org.drools.util.Iterator#next()
*/
public Object next() {
while ( true ) {
if ( this.list == null ) {
// check if there is a current bucket
while ( this.list == null ) {
// iterate while there is no current bucket, trying each array position
this.list = (LeftTupleList) this.table[this.row];
{code}
on the reset we do:
{code}
public void reset() {
this.table = this.hashTable.getTable();
this.length = this.table.length;
this.row = 0;
this.list = null;
this.leftTuple = null;
}
{code}
So now it's reset to 0, which shows lack of consistency. Need to be careful though as just defaulting the constructor to 0 may incorrect behaviour. Once correct I suspect the same bug will be in RightTupleIndexHashTable.
> ArrayIndexOutOfBoundsException in ReteooRuleBase.addPackage() in 5.1.0.M2
> -------------------------------------------------------------------------
>
> Key: JBRULES-2574
> URL: https://jira.jboss.org/browse/JBRULES-2574
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 5.1.0.M2
> Environment: Linux jmv-desktop 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 08:03:28 UTC 2010 x86_64 GNU/Linux
> java -version
> java version "1.6.0_20"
> Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
> Reporter: Jean-Marc Vanel
> Assignee: Mark Proctor
>
> It seems related to having a not too small Working Memory (622 objects), and then compiling and adding several not too small rules packages. It runs fine on 5.1.0.M1 and before, but crashes 5.1.0.M2 and on today's 5.1.0.SNAPSHOT.
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 128
> at org.drools.core.util.LeftTupleIndexHashTable$FieldIndexHashTableFullIterator.next(LeftTupleIndexHashTable.java:153)
> at org.drools.reteoo.NotNode.updateSink(NotNode.java:471)
> at org.drools.reteoo.RuleTerminalNode.attach(RuleTerminalNode.java:395)
> at org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:177)
> at org.drools.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:128)
> at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:117)
> at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:409)
> at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:638)
> at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:520)
> at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:435)
> at DroolsRunExportedProjectOldAPI.loadSource(DroolsRunExportedProjectOldAPI.java:124)
> at DroolsRunExportedProjectOldAPI.main(DroolsRunExportedProjectOldAPI.java:79)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list