[jboss-jira] [JBoss JIRA] Commented: (JBRULES-904) ArrayIndexOutOfBoundsException in org.drools.util.TupleIndexHashTable.toArray
Dirk Bergstrom (JIRA)
jira-events at lists.jboss.org
Tue Jun 5 20:21:08 EDT 2007
[ http://jira.jboss.com/jira/browse/JBRULES-904?page=comments#action_12364304 ]
Dirk Bergstrom commented on JBRULES-904:
----------------------------------------
I hacked the method to get some diagnostic info out of it -- bumped up the size of the result array, and added some println() calls:
public Entry[] toArray() {
Entry[] result = new Entry[this.size*1000];
System.out.println("this.size=" + this.size);
int index = 0;
System.out.println("this.table.length=" + this.table.length);
for ( int i = 0; i < this.table.length; i++ ) {
FieldIndexEntry fieldIndexEntry = (FieldIndexEntry)this.table[i];
if ( fieldIndexEntry != null ) {
System.out.println("New non-null fieldIndexEntry");
Entry entry = fieldIndexEntry.getFirst();
while ( entry != null ) {
System.out.println("index=" + index);
result[index++] = entry;
entry = entry.getNext();
}
}
}
return result;
}
Running with this method, I get the following output:
this.size=26
this.table.length=64
New non-null fieldIndexEntry
index=0
[...]
index=96
New non-null fieldIndexEntry
index=97
[...]
index=193
New non-null fieldIndexEntry
[...]
Repeating at:
290
387
484
581
678
775
876
977
1074
1171
1268
1365
1462
1559
1656
1753
1850
Ending at:
index=1951
> 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: Mark Proctor
>
> 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
More information about the jboss-jira
mailing list