[rules-users] get new errors caused by KnowledgeBuilder.add()

Wolfgang Laun wolfgang.laun at gmail.com
Sun Jun 10 01:28:49 EDT 2012


If the list of errors is extended by errors detected during another
kb.add(): why not just keep track of the last size() of the list? New
errors are bound to appear at the end of the list.
-W

On 10 June 2012 01:44, Sandeep Bandela <gibsosmat at gmail.com> wrote:

> Hi,
> I have rules (drl format strings) stored in a database column in a schema
> like MyRules(rule_id integer, name text, rule text, enabled boolean ... )
> I query the db to get them and iterate over the rows and add using
> KnowledgeBuilder.add() using String.getBytes. (I dont want to move to
> guvnor as of now)
> some rules might have compilation errors, hence the
> KnowledgeBuilder.hasErrors() is set to true.
> those will not be added to the package by the PackageBuilder.
>
> My problem is to log the error causing rule_id and the error message.
> KnowledgeBuilderErrors dosent expose the internal errors list so that I
> could see if any new errors are in the arraylist from the last time error
> seen time and log them.
> But only solution i could think of is using the low level api of using
> DrlParser to pre-parse it to check for errors+log and add to the kBuilder
> if its not failed.
>
> is there any elegant way to do this?
>
> I am using drools-5.2.0.final
>
>
>
>
> --
> Regards,
> Sandeep Bandela.
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120610/880cfe16/attachment.html 


More information about the rules-users mailing list