[rules-users] NPE in ClassFieldExtractor.getValue()

Leonardo Gomes leonardo.f.gomes at gmail.com
Fri Sep 24 09:11:15 EDT 2010


Hello Guys,

I'm having a NPE in the ClassFieldExtractor.getValue(InternalWorkingMemory,
Object) line: 127

It happens while executing the RHS of a rule that modifies one fact and then
updates one and retract another.

rule "foo"

when
    ...
then
    // apply changes
    PolicyHelper.makeInPolicy($room, $pRoom.getCompliantRuleId(),
    $pRoom.getPrefLevel(), ProfileTypeEnum.COMPANY);

    update($room);
    retract($pRoom);
end

--

We're using good old 4.0.7, with ShadowFacts :(

I tracked down the problem to

FactHandleIndexHashTable$FieldIndexEntry.matches(ReteTuple, int) line:
> 385
>

Where,

this.first.getFactHandle()
>

Returns an invalidated fact handle (a handle of a fact that has been
retracted before, I imagine). The NPE happens because invalidated handles
have their "object" attribute
set to "null" and the matches method mentioned above does:

        public boolean matches(final ReteTuple tuple,
>                                final int tupleHashCode) {
>             return this.hashCode == tupleHashCode && this.index.equal( *
> this.first.getFactHandle().getObject()*,
>
> tuple );
>


Is there something I could do to workaround this problem? Any clue is
welcome.

Thanks,
Leo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100924/61d6170e/attachment.html 


More information about the rules-users mailing list