[jboss-jira] [JBoss JIRA] Commented: (JBRULES-904) ArrayIndexOutOfBoundsException in org.drools.util.TupleIndexHashTable.toArray

Brian Stiles (JIRA) jira-events at lists.jboss.org
Tue Jun 26 19:30:57 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBRULES-904?page=comments#action_12366940 ] 
            
Brian Stiles commented on JBRULES-904:
--------------------------------------

Well, I can't confirm that the toArray problem is fixed because after backing out my changes and applying yours, I'm back to the problem that originally led me here.  I think I may have run into the ArrayIndexOutOfBoundsException when I was investigating this problem (having made some experimental changes).  It may be that I'm confusing two different problems, but I suspect they're related.

After applying your changes, I now get the following exception (which I was getting originally):

Exception in thread "main" java.lang.NullPointerException
	at org.drools.rule.VariableRestriction.isAllowedCachedRight(VariableRestriction.java:79)
	at org.drools.rule.VariableConstraint.isAllowedCachedRight(VariableConstraint.java:78)
	at org.drools.common.DoubleBetaConstraints.isAllowedCachedRight(DoubleBetaConstraints.java:149)
	at org.drools.reteoo.CollectNode.assertObject(CollectNode.java:220)
	at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:317)
	at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:159)
	at org.drools.reteoo.Rete.assertObject(Rete.java:175)
	at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
	at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:772)


The cause of the above exception is the fact that org.drools.util.TupleIndexHashTable.toArray produces an array with nulls in it.  I assumed that this was probably related to the ArrayIndexOutOfBoundException, but it may be a separate problem.  I'd be happy to open a new bug if appropriate.

The nulls in the array, I believe, come from the first/next mismatch described above.  Are the assumptions in my prior post valid?

What other information can I give you?

> 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

        



More information about the jboss-jira mailing list