I'd prefer not to mask NPE and not to check for null if we are not
expecting object to be null. And not just from performance perspective
but rather to catch problems in logic as Edson described.
-Alex

-----Original Message-----
From: Edson Tirelli [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 15, 2006 11:45 AM
To: [email protected]
Subject: [drools-dev] Waltz errors (was: New ClassFieldExtractor)

   Ok,

   So, the problem was that modifyObject() method inside the NotNode
was removing the fact from the beta memory and not adding it again, so
if a second modifyObject() call was made for the same fact, a NPE was
being raised for trying to remove a fact that is not there anymore.

   I fixed the problem inside modifyObject() and added test case for it.

   Also, I added null reference checks to the *LinkedList data
structures as well as all BetaMemory implementations to avoid mistakes
like that. Although, this comes with a small overhead that, being
drools core so performance critical, we need to discuss if we want or
not. I mean, if all the code is correct, no remove() call will be made
in the beta memory for objects that are not there, so the null
reference checks are waste of processing. BUT, if there are errors in
the code (like the one in the modify), a NPE might be raised if no
null reference checks are made. What shall we do?
   Right now, checks are there and no NPE will raise from
BetaMemories, even if there are problems in the Rete implementation.

   Waltz is failing now with an ArrayOutOfBounds inside a JoinNode. I
will investigate tonight.

   Regards,
     Edson



Edson Tirelli wrote:

>   Mark,
>
>   If this is inside DefaultRightMemory, it might be related to
> indexing, but the DefaultRightMemory itself is not indexed. I will
> take a look.
>
>   []s
>   Edson
>
>
> Mark Proctor wrote:
>
>> I wonder if this is to do with the new indexing stuff? If we can
>> isolate the issue we should produce a unit test to track this issue
>> for regression.
>>
>> Mark
>> Alexander Bagerman wrote:
>>
>>> Michael,
>>> It is very easy to see if you run
>>> org.drools.examples.waltz.ReteooWaltzTest as JUnit test. If I
>>> remember it correctly it start failing
>>> DefaultRightMemory.remove(WorkingMemory
>>> workingMemory, ObjectMatches matches)  with matches being null. not
>>> null check uncovers another place on stack that has similar problem.
>>> I might be off in terms of the exact location but I suggest you run
>>> and see it for yourself.
>>> Thanks
>>> -Alex
>>>
>>> -----Original Message-----
>>> From: Michael Neale [mailto:[EMAIL PROTECTED]
>>> Sent: Monday, March 13, 2006 3:32 PM
>>> To: [email protected]
>>> Cc: Mark Proctor
>>> Subject: Re: [drools-dev] Re: New ClassFieldExtractor
>>>
>>> are these nulled out node references?
>>>
>>> On 3/14/06, Alexander Bagerman <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>> Mark,
>>>> Somebody should definitely take a look at waltz under reteoo. I
>>>> started going up the stack of NullPointerException and found
>>>> several places on the stack where exception can be thrown. I gave
>>>> up after third place where I put if ( != null) { without getting
>>>> into what is going on in that part of the code.
>>>> -Alex
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>


--
  ---
  Edson Tirelli
  Auster Solutions do Brasil
  @ www.auster.com.br
  +55 11 5096-2277 / +55 11 9218-4151

Reply via email to