> Hi,
> 
Sorry, the previous mail was sent prematurely.

> There seems to be an issue with simple patterns and non initialized
> slots derived from Java Beans.
> 
> I have the following class and a clp:
> 
> public class Slots {
>       private Short age;
>       public Slots() {
> //            age = (short) 1;
>       }
>       public Short getAge() {
>               return age;
>       }
>       public void setAge(Short age) {
>               this.age = age;
>       }       
> }
> 
> (import Slots)
> (deftemplate Slots
> (declare (from-class Slots)))
> 
> (defrule rule
>     (Slots { (age > 0)} )
> =>
>     (printout t "age must not be null" crlf)
> )
> 
> (bind ?sl (new Slots))
> (add ?sl)
> (run)
> 
> If the age member initialized, it runs fine. If it is not, Jess throws
> an exception.
> 
> Jess reported an error in routine >
>       while executing (> ?__synth0(0,0,-1) 0)
>       while executing rule LHS (TEQ)
>       while executing rule LHS (TECT)
>       while executing (add ?sl).
>   Message: compareTo threw an exception.
>   Program text: ( add ?sl )  at line 12 in file D:\temp\slot.clp.
> 
> Nested exception is:
> java.lang.Integer cannot be cast to java.lang.String
> 
> Shouldn't Jess fail the test when the slot is not initialized?
> 
> Son Nguyen
> 

Reply via email to