[rules-users] NPE on retract
Edson Tirelli
tirelli at post.com
Tue Apr 24 17:10:41 EDT 2007
Chris
Can you provide a self contained test that shows the problem and open a
JIRA with it?
I will take a look in it.
There is no requirement to define equals/hashcode, but if you do so, you
need to make them time consistent, i.e., they cannot change during the time
the object is asserted into the working memory or you may have problems (as
hashcode and equals behaviors are defined as kind of "identity" of the
object).
[]s
Edson
2007/4/24, Chris West <crayzfishr at gmail.com>:
>
> Mark,
>
> The object being retracted currently has no hashcode and equals, therefore
> defaulting to the ones on Object. The reason I'm even retracting the object
> is so that I can assert it again to work around bug
> http://jira.jboss.com/jira/browse/JBRULES-614. Therefore the reason I am
> retracting the object is because it has changed.
>
> Is there a requirement to implement hashcode and equals? If so, does it
> have to be based on all fields of the pojo? My intent was to implement
> hashcode and equals, but only base them on the id fields of the class.
>
> -Chris
>
> On 4/24/07, Mark Proctor <mproctor at codehaus.org> wrote:
> >
> > Have you correctly implemented your equals and hashcode? Have you made
> > sure that the objects fields haven't changed between the assert and the
> > retract?
> >
> > Mark
> > Chris West wrote:
> >
> > Hi,
> >
> > Using version 3.0.6 of jboss rules, while retracting an object, I get
> > the following:
> >
> > java.lang.NullPointerException
> > at org.drools.reteoo.beta.InstanceEqualConstrRightMemory.remove(Unknown
> > Source)
> > at org.drools.reteoo.BetaMemory.remove (Unknown Source)
> > at org.drools.reteoo.NotNode.retractObject(Unknown Source)
> > at org.drools.reteoo.ObjectSource.propagateRetractObject(Unknown
> > Source)
> > at org.drools.reteoo.RightInputAdapterNode.retractTuple (Unknown
> > Source)
> > at org.drools.reteoo.TupleSource.propagateRetractTuple(Unknown
> > Source)
> > at org.drools.reteoo.NotNode.retractTuple(Unknown Source)
> > at org.drools.reteoo.TupleSource.propagateRetractTuple (Unknown
> > Source)
> > at org.drools.reteoo.JoinNode.retractObject(Unknown Source)
> > at org.drools.reteoo.ObjectSource.propagateRetractObject(Unknown
> > Source)
> > at org.drools.reteoo.ObjectTypeNode.retractObject (Unknown Source)
> > at org.drools.reteoo.Rete.retractObject(Unknown Source)
> > at org.drools.reteoo.ReteooRuleBase.retractObject(Unknown Source)
> > at org.drools.reteoo.ReteooWorkingMemory.doRetract(Unknown Source)
> > at org.drools.common.AbstractWorkingMemory.retractObject(Unknown
> > Source)
> > at org.drools.common.AbstractWorkingMemory.retractObject(Unknown
> > Source)
> > at ascc.rules.AbstractRulesCoordinator.statusChanged(
> > AbstractRulesCoordinator.java :354)
> > at ascc.rules.AbstractRulesCoordinator$1.statusChanged(
> > AbstractRulesCoordinator.java:111)
> > at ascc.status.BaseStatusBoard.notifyChange(BaseStatusBoard.java
> > :211)
> > at ascc.status.BaseStatusBoard.notifyChange (BaseStatusBoard.java
> > :191)
> > at ascc.status.DefaultParkingStatusBoard.empty(
> > DefaultParkingStatusBoard.java:318)
> > at ascc.spotting.DefaultSpottingCoordinator.computeInitialSpot(
> > DefaultSpottingCoordinator.java:578)
> > at ascc.spotting.DefaultSpottingCoordinator.statusCreated(
> > DefaultSpottingCoordinator.java:827)
> > at ascc.status.BaseStatusBoard.notifyCreate(BaseStatusBoard.java
> > :100)
> > at ascc.status.BaseStatusBoard.notifyCreate (BaseStatusBoard.java
> > :80)
> > at ascc.status.DefaultAirPlanStatusBoard.missionAssignmentComplete(
> > DefaultAirPlanStatusBoard.java:479)
> > at
> > ascc.missionassignment.Rule_6___Complete_mission_assignment_for_event_0.consequence(Rule_6___Complete_mission_assignment_for_event_0.java:36)
> > at
> > ascc.missionassignment.Rule_6___Complete_mission_assignment_for_event_0ConsequenceInvoker.evaluate(Rule_6___Complete_mission_assignment_for_event_0ConsequenceInvoker.java:24)
> >
> > ... 7 more
> >
> > Is there something I could be doing wrong? Is this a known bug?
> >
> > Thanks,
> > -Chris
> >
> > ------------------------------
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070424/ee5a30d9/attachment.html
More information about the rules-users
mailing list