[jboss-jira] [JBoss JIRA] Created: (JBRULES-2017) Custom exception handler for condition evaluator

Sergej Iljin (JIRA) jira-events at lists.jboss.org
Fri Mar 20 05:52:23 EDT 2009


Custom exception handler for condition evaluator
------------------------------------------------

                 Key: JBRULES-2017
                 URL: https://jira.jboss.org/jira/browse/JBRULES-2017
             Project: JBoss Drools
          Issue Type: Feature Request
      Security Level: Public (Everyone can see)
          Components: drools-core
    Affects Versions: 5.0.0.CR1, 5.0.0.M5
            Reporter: Sergej Iljin
            Assignee: Mark Proctor
            Priority: Critical
             Fix For: 5.0.0.GA


Custom exception handler for condition evaluator.

Its proposed to introduce custom exception handler for condition evaluator becaue "always re-trow" approach is not appropriate for some cases when fail-safe rule execution is necessary.

There is an requirment which can't be satisfied with current implementation of condition evaluator: "All rules that are present in agenda should be performed fail safe and independed". 
So it means that if there are 2 rules and one of them throws a NullPointer exception while condition evaluation (because of wrong configuration) the second rule have to be performed.

Changes have to be applied to following class:
drools-core\src\main\java\org\drools\rule\EvalCondition.java 
in method:
    public boolean isAllowed(final Tuple tuple,
                             final WorkingMemory workingMemory,
                             final Object context) {
        try {
            return this.expression.evaluate( tuple,
                                             this.requiredDeclarations,
                                             workingMemory,
                                             context );
        } catch ( final Exception e ) {
            throw new RuntimeDroolsException( this.getEvalExpression() + " : " + e,
                                              e );
        }
    }

should be replaced with somethig like this

    public boolean isAllowed(final Tuple tuple,
                             final WorkingMemory workingMemory,
                             final Object context) {
        try {
            return this.expression.evaluate( tuple,
                                             this.requiredDeclarations,
                                             workingMemory,
                                             context );
        } catch ( final Exception e ) {
            getExceptionHandler().handle(e);
        }
    }



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list