Package org.drools.compiler

Examples of org.drools.compiler.RuleError


        JavaAnalysisResult result = null;
        try {
            result = this.analyzer.analyzeBlock( text,
                                                 new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
        } catch ( final Exception e ) {
            context.getErrors().add( new RuleError( context.getRule(),
                                                    descr,
                                                    e,
                                                    "Unable to determine the used declarations.\n" + e) );
        }
        return result;
View Full Code Here


            final Serializable expr = ((MVELDialect) context.getDialect()).compile( (String) predicateDescr.getContent(), analysis, null, null, context );           
           
            predicate.setPredicateExpression( new MVELPredicateExpression( expr,
                                                                           factory ) );
        } catch ( final Exception e ) {
            context.getErrors().add( new RuleError( context.getRule(),
                                                    predicateDescr,
                                                    e,
                                                    "Unable to build expression for 'inline-eval' node '" + predicateDescr.getContent() + "'\n" + e.getMessage() ) );
        }
    }
View Full Code Here

            MVELSalienceExpression salience = new MVELSalienceExpression( expr,
                                                                          factory );

            context.getRule().setSalience( salience );
        } catch ( final Exception e ) {
            context.getErrors().add( new RuleError( context.getRule(),
                                                    context.getRuleDescr(),
                                                    null,
                                                    "Unable to build expression for 'salience' node '" + context.getRuleDescr().getSalience() + "'" ) );
        }
    }
View Full Code Here

                                                                     analysis.getBoundIdentifiers() );

            context.getRule().setConsequence( new MVELConsequence( expr,
                                                                   factory ) );
        } catch ( final Exception e ) {
            context.getErrors().add( new RuleError( context.getRule(),
                                                    context.getRuleDescr(),
                                                    null,
                                                    "Unable to build expression for 'consequence' '" + context.getRuleDescr().getConsequence() + "'" ) );
        }
    }
View Full Code Here

        final PackageBuilder builder = new PackageBuilder();
        builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "errors_in_rule.drl" ) ) );
        final Package pkg = builder.getPackage();

        final DroolsError err = builder.getErrors().getErrors()[0];
        final RuleError ruleErr = (RuleError) err;
        assertNotNull( ruleErr.getDescr() );
        assertTrue( ruleErr.getLine() != -1 );

        final DroolsError errs[] = builder.getErrors().getErrors();

        assertEquals( 3,
                      builder.getErrors().getErrors().length );

        // check that its getting it from the ruleDescr
        assertEquals( ruleErr.getLine(),
                      ruleErr.getDescr().getLine() );
        // check the absolute error line number (there are more).
        assertEquals( 11,
                      ruleErr.getLine() );

        // now check the RHS, not being too specific yet, as long as it has the
        // rules line number, not zero
        final RuleError rhs = (RuleError) builder.getErrors().getErrors()[2];
        assertTrue( rhs.getLine() > 7 ); // not being too specific - may need to
        // change this when we rework the error
        // reporting

    }
View Full Code Here

TOP

Related Classes of org.drools.compiler.RuleError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.