<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=177285010-26042007>JIRA-749 relates to NPE's in
"org.drools.reteoo.RuleTerminalNode.retractTuple".</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=177285010-26042007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=177285010-26042007>Whether this is related....</SPAN></FONT></DIV><FONT
face=Arial color=#0000ff size=2></FONT><BR>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Chris
West<BR><B>Sent:</B> 25 April 2007 14:25<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> Re: [rules-users] NPE on retract<BR></FONT><BR></DIV>
<DIV></DIV>I'll try to create a self contained test. It may be a
difficult task. The error seems to come and go depending on which other rules
I leave in my rule set. In particular, there is another rule that has
many conditions and only logs a message as the consequence that when it is
included in the rule set, this error occurs. That particular rule has
nothing to do with the type of object being retracted. <BR><BR>My
misunderstanding was that Drools used object identity with an IdentifyHashMap
unless it was configured to use a regular HashMap. Is this not the
case?<BR><BR>Concerning not having equals/hashcode changing while the object
is asserted into working memory, is it ok for them to change as long as it is
followed by a "modify("? Is there different behavior between calling
"modify" and calling "retract and re-assert"? <BR><BR>Thanks for you
help,<BR>-Chris<BR><BR>
<DIV><SPAN class=gmail_quote>On 4/24/07, <B class=gmail_sendername>Edson
Tirelli</B> <<A href="mailto:tirelli@post.com">tirelli@post.com</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><BR>
Chris<BR><BR> Can you provide a self contained test that shows
the problem and open a JIRA with it? <BR> I will take a look in
it.<BR><BR> 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).<BR><BR> []s <BR>
Edson<BR><BR>
<DIV><SPAN class=gmail_quote>2007/4/24, Chris West <<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:crayzfishr@gmail.com"
target=_blank>crayzfishr@gmail.com</A>>:</SPAN>
<DIV><SPAN class=e id=q_11225726b98891c4_1>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Mark,<BR><BR>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 <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://jira.jboss.com/jira/browse/JBRULES-614"
target=_blank>http://jira.jboss.com/jira/browse/JBRULES-614</A>.
Therefore the reason I am retracting the object is because it has
changed.<BR><BR>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. <BR><SPAN><BR>-Chris</SPAN>
<DIV><SPAN><BR><BR>
<DIV><SPAN class=gmail_quote>On 4/24/07, <B class=gmail_sendername>Mark
Proctor</B> <<A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:mproctor@codehaus.org" target=_blank>
mproctor@codehaus.org</A>> wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV text="#000000" bgcolor="#ffffff">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?<BR><BR>Mark<BR>Chris
West wrote:
<BLOCKQUOTE type="cite">
<DIV><SPAN>Hi,<BR><BR>Using version 3.0.6 of jboss rules, while
retracting an object, I get the
following:<BR><BR> java.lang.NullPointerException<BR>
at
org.drools.reteoo.beta.InstanceEqualConstrRightMemory.remove(Unknown
Source)<BR> at org.drools.reteoo.BetaMemory.remove
(Unknown Source)<BR> at
org.drools.reteoo.NotNode.retractObject(Unknown
Source)<BR> at
org.drools.reteoo.ObjectSource.propagateRetractObject(Unknown
Source)<BR> at
org.drools.reteoo.RightInputAdapterNode.retractTuple (Unknown
Source)<BR> at
org.drools.reteoo.TupleSource.propagateRetractTuple(Unknown
Source)<BR> at
org.drools.reteoo.NotNode.retractTuple(Unknown
Source)<BR> at
org.drools.reteoo.TupleSource.propagateRetractTuple (Unknown
Source)<BR> at
org.drools.reteoo.JoinNode.retractObject(Unknown
Source)<BR> at
org.drools.reteoo.ObjectSource.propagateRetractObject(Unknown
Source)<BR> at
org.drools.reteoo.ObjectTypeNode.retractObject (Unknown Source)
<BR> at org.drools.reteoo.Rete.retractObject(Unknown
Source)<BR> at
org.drools.reteoo.ReteooRuleBase.retractObject(Unknown
Source)<BR> at
org.drools.reteoo.ReteooWorkingMemory.doRetract(Unknown
Source)<BR> at
org.drools.common.AbstractWorkingMemory.retractObject(Unknown
Source)<BR> at
org.drools.common.AbstractWorkingMemory.retractObject(Unknown
Source)<BR> at
ascc.rules.AbstractRulesCoordinator.statusChanged(AbstractRulesCoordinator.java
:354)<BR> at
ascc.rules.AbstractRulesCoordinator$1.statusChanged(AbstractRulesCoordinator.java:111)<BR>
at
ascc.status.BaseStatusBoard.notifyChange(BaseStatusBoard.java:211)<BR>
at ascc.status.BaseStatusBoard.notifyChange
(BaseStatusBoard.java:191)<BR> at
ascc.status.DefaultParkingStatusBoard.empty(DefaultParkingStatusBoard.java:318)<BR>
at
ascc.spotting.DefaultSpottingCoordinator.computeInitialSpot(DefaultSpottingCoordinator.java:578)
<BR> at
ascc.spotting.DefaultSpottingCoordinator.statusCreated(DefaultSpottingCoordinator.java:827)<BR>
at
ascc.status.BaseStatusBoard.notifyCreate(BaseStatusBoard.java:100)<BR>
at ascc.status.BaseStatusBoard.notifyCreate
(BaseStatusBoard.java:80)<BR> at
ascc.status.DefaultAirPlanStatusBoard.missionAssignmentComplete(DefaultAirPlanStatusBoard.java:479)<BR>
at
ascc.missionassignment.Rule_6___Complete_mission_assignment_for_event_0.consequence
(Rule_6___Complete_mission_assignment_for_event_0.java:36)<BR>
at
ascc.missionassignment.Rule_6___Complete_mission_assignment_for_event_0ConsequenceInvoker.evaluate(Rule_6___Complete_mission_assignment_for_event_0ConsequenceInvoker.java:24)
<BR> ... 7 more<BR><BR>Is there something I could be
doing wrong? Is this a known
bug?<BR><BR>Thanks,<BR>-Chris<BR></SPAN></DIV><PRE><HR width="90%" SIZE=4>
_______________________________________________<BR>rules-users mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org" target=_blank>rules-users@lists.jboss.org
<BR><BR></A>
<A onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A>
</PRE></BLOCKQUOTE><BR></DIV><BR>_______________________________________________<BR>rules-users
mailing list<BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:rules-users@lists.jboss.org"
target=_blank>rules-users@lists.jboss.org </A><BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR></BLOCKQUOTE></DIV><BR></SPAN></DIV><BR>_______________________________________________<BR>rules-users
mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:rules-users@lists.jboss.org"
target=_blank>rules-users@lists.jboss.org </A><BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR></BLOCKQUOTE></SPAN></DIV></DIV><SPAN
class=sg><BR><BR clear=all><BR>-- <BR> Edson
Tirelli<BR> Software Engineer - JBoss Rules Core
Developer<BR> Office: +55 11 3529-6000<BR> Mobile: +55
11 9287-5646<BR> JBoss, a division of Red Hat @ <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.jboss.com" target=_blank>www.jboss.com</A>
</SPAN><BR>_______________________________________________<BR>rules-users
mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A>
<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>