Shabbir,
Do you still need to code section for this? If so, can you show me how you are loading this into the Working Memory(i.e. the Java code you use prior to executing the rules).
Shannon
All right, let's hope that "business user" is up to write the rules, even without null checks ;-)
Seriously now: are they up to handling monetary units represented as floating point numbers? A recent thread has emphasized the problems arising from tests such as floatVal <= floatConst, and I've been preaching about possible inconsistencies due to the inherent nature of FP arithmetic, even for doing sums. BigDecimal is one solution, but I guess your BUs will go ballistic if you tell them about the consequences...
But here's my last proposal for circumnavigating the NPE issue:
At the point of fact insertion, wrap all "dangerous" bean objects into a container fact with a single field and insert the container. Write rules matching the container, testing the wrapped object for field == null and whatever; if so, change and log; and now insert the wrapped object as a fact proper. (If necessary, you could even write a single rule for all fact types, using inspection to determine all dangerous fields.)
-W2009/5/14 Shabbir Dhari <sdhari@hotmail.com>_______________________________________________Thanks to all.
> Date: Wed, 13 May 2009 08:28:53 -0700
The problem we have is that rules will be code by business user. As a developer I don’t mind putting null check on every rule. But for business user its unacceptable for checking null for the same attribute in around 50 rules.
Shannon, can you please elaborate more about your solution or if possible post some simple code?
> From: greg_barton@yahoo.com
> Subject: RE: [rules-users] NullPointerException with Wrapper objects
> To: rules-users@lists.jboss.org
>
>
> Well, like Wolfgang said, good luck with that. :) The only rules engine I know that does this is Tibco BusinessEvents, and it's accomplished by making a copy of your objects before inserting them into working memory.
>
> >From this forum post I'm guessing JRules doesn't do it: http://forums.ilog.com/brms/index.php?topic=1439.0
>
> And probably Blaze Advisor doesn't do it either:
> http://discuss.fico.com/blaze/board/message?board.id=Blaze_Advisor_Users_Forum&message.id=591
>
> So, I'm thinking you're stuck with having to do null checks.
>
Click Here View photos of singles in your area
rules-users mailing list
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users