[
http://jira.jboss.com/jira/browse/JBRULES-904?page=comments#action_12366927 ]
Brian Stiles commented on JBRULES-904:
--------------------------------------
I think I'm either wrong in my assumptions or org.drools.util.TupleIndexHashTable is
more broken than I originally thought.
My assumption is that there should be a one to one correspondence of
TupleIndexHashTable.FieldIndexEntry objects to ReteTuples and that the
FieldIndexEntry's first and next should correspond to the corresponding ReteTuple and
it's next. That's what I assume
org.drools.util.TupleIndexHashTable.FieldIndexEntry.add(ReteTuple) tries to make true.
With my above patch, my assumption holds true until
org.drools.util.AbstractHashTable.resize(int) is called. resize fixes up the
relationships of the FieldIndexEntrys but not the ReteTuples. I don't know about
remove, yet. If I disable the call to resize, I don't get the
ArrayIndexOutOfBoundsException and things seem to work fine.
Can anyone confirm or deny my assumptions? If my assumptions are wrong, I need to rethink
(or be told) how the table is supposed to work and my previous comments should probably be
disregarded.
ArrayIndexOutOfBoundsException in
org.drools.util.TupleIndexHashTable.toArray
-----------------------------------------------------------------------------
Key: JBRULES-904
URL:
http://jira.jboss.com/jira/browse/JBRULES-904
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 4.0.0.MR3
Environment: Java 1.5
Reporter: Dirk Bergstrom
Assigned To: Edson Tirelli
Attachments: real-testcase.tgz, testcase.tar.gz
When asserting a particular object type, I get the following stacktrace:
java.lang.ArrayIndexOutOfBoundsException: 26
at org.drools.util.TupleIndexHashTable.toArray(TupleIndexHashTable.java:178)
at org.drools.reteoo.CollectNode.assertObject(CollectNode.java:212)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:317)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:183)
at org.drools.reteoo.Rete.assertObject(Rete.java:121)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:201)
at
org.drools.reteoo.ReteooWorkingMemory.doAssertObject(ReteooWorkingMemory.java:70)
at
org.drools.common.AbstractWorkingMemory.assertObject(AbstractWorkingMemory.java:766)
at
org.drools.common.AbstractWorkingMemory.assertObject(AbstractWorkingMemory.java:578)
at
net.juniper.dash.data.DataSource.reconcileAssertedRecords(DataSource.java:250)
at net.juniper.dash.data.DataSource.populateRecords(DataSource.java:193)
at net.juniper.dash.Updater$DataSourceProcessor.work(Updater.java:177)
at net.juniper.dash.Refresher.run(Refresher.java:69)
I added some println() statements, and it's not an off-by-one error, it's
something more serious. I changed the allocated size of the array to (this.size * 10),
and it *still* tried to overfill the array. The hashtable had 26 entries, but it tried to
add 261, and counting.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira