I think Nik wrote:
> Hi all,
> 
> I have a java program that uses a Rete inside of it, and I initialize the Rete using 
>a
> batch command that puts a flat file full of JESS code into the Rete.  When I run the 
>Rete
> and I get a runtime error, I can print out the exception message, however, the line
> number it gives me is -1.  Why does this happen and is there any way around it?
> 
> - Nik.
> 

If you use executeCommand() to run (batch), the line number reported
is always going to be -1 or 0. It's the line number in an internal
buffer used to parse the (batch) command itself (note that the error
message will say the offending line is "(batch whatever)".  This seems
confusing, but it makes perfect sense if you were doing
executeCommand("(defrule ...)"). executeCommand() treats (batch) as if
it were any other command.

If you want to see the error message as originally produced by
(batch), you can call batch directly. One way to do so would be to use
a Funcall object:

        Rete r = ...
        Funcall f = new Funcall("batch", r);
        f.arg(new Value(myFileName, RU.STRING));
        Value result = f.execute(r.getGlobalContext());


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to