A Java Based Decision Table Rules Engine

Error Messages in EL

Posted by Paul Snow on July 6, 2012

The Default compiler has ”very” simple error reporting. By simple, we mean somewhat cryptic.

The error reporting will only report one error per statement (i.e. context statement, or initial action statement, or condition statement, etc.). Once you fix an error on a statement, you may have another error that occurs after the error you fixed.

Example quote.message.channel error
When an error occurs, it is reported in a form like this:

Decision Table: Quote_Request
Filename: Quote_Manager_dt.xls

Source: quote.message.channel is equal to RETAIL
Error: java.lang.Exception: Error found at Line:Char =0:30 java.lang.Exception: java.lang.Error: Error: could not match input
Info: Old Postfix: None in XML
26 CONDITION condition
122 RENTITY quote.message

Here is what each line is telling you.

  • ”’Decision Table”’ tells what decision table holds the error
  • ”’Filename”’ gives the filename where that decision table is located (which helps when you have your decision tables in multiple files).
  • ”’Source”’ details the actual statement in the decision table that has the error.
  • ”’Error”’ should be something useful. In this case it isn’t, other than to give the character offset to the error.
  • ”’Info”’ gives you the list of tokens parsed. ”’This is the most useful part of the error message.”’ Every list will lead with the section name of the table where the error was found.

In the example abouve, only two tokens were shown:

  • CONDITION This was a condition statement that failed.
  • RENTITY The next token parsed was an Entity (i.e. quote.message defines an Entity object)

At this point, either the syntax cannot lead with an Entity object, or an error occurs before another valid token can be found. In this particular case, the problem is the use of the “dot” syntax.

The “dot” syntax allows you to qualify a name to restrict its value to entities in the context with the given name. In this case, ”’message”’ must be defined by an entity named ”’quote”’. The user however goes on to try and use the dot syntax to go down another level. But while ”’quote.message”’ does define an entity, it isn’t an entity name. What is intended is to use the channel attribute of the quote.message entity. The fix in this case should be:

quote.message’s channel

Example Undefined Attribute

Here is another typical error, one where the attribute hasn’t been defined.

Decision Table: Quote_Request
Filename: Quote_dt.xls

Source: quote.code is equal to BANK
Error: java.lang.Exception: Error found at Line:Char =0:37 java.lang.Exception: Can’t recover from previous error(s)
Info: Old Postfix: None in XML
26 CONDITION condition
130 RSTRING quote.code
50 EQ is equal to

In this case the last token BANK was undefined. What was intended was likely for BANK to be a constant defined in the EDD. Assuming code is some integer value, replacing BANK with its code number (like 8) would fix the problem. The better solution would be to define a read only constant in the EDD with the attribute BANK given a defaultvalue of 8.

Leave a Comment