Hi all,

We found a test program that indicates that Jess should (re)raise exceptions 
from Java to Java.
I typed in the code below, and of course it confirmed my suspicions that no 
exception was raised.
We then tried upgrading Jess (from 7.0p1 to 7.1p2), but no change.

That surprised us, so we looked a bit better; can you spot the mistake in the 
program below?
Are you sure you DON'T want a JessException, or *any* exception for this 
mistake? (i.e. should I file a bug report or feature request?)

Knowing it worked, we knew better where to look and found the place where the 
Exception was caught in our code, rather than our framework.
Found it; original question answered.

Bye,
Kero.


import jess.*;

public class TryIt {
    public static void main(String arg[]) {
        try {
            Rete r = new Rete();
            r.eval("new java.net.URL foo://bar/");
        } catch (JessException e) {
            e.printStackTrace();
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
}


__
Kero van Gelder
Software Engineer
Systems Creation
MiPlaza
Philips Research Europe
High Tech Campus 34.6.12 (WY61)
5656 AE Eindhoven
Tel: +31-40-27.47905
E-mail: kero.van.gel...@philips.com
http://www.miplaza.com/

________________________________________
From: owner-jess-us...@sandia.gov [owner-jess-us...@sandia.gov] On Behalf Of 
Gelder, Kero van [kero.van.gel...@philips.com]
Sent: Thursday, January 13, 2011 13:13
To: jess-users@sandia.gov
Subject: JESS: Catching a java exception via Jess in Java

Hello!

We are writing unit tests around or software with JUnit and JMock.
When we run certain tests, Jess will call Java methods.
In the unit tests, JMock provides stubs for these methods.
With the expectations set, these method calls may raise an exception.
Jess catches this exception and prints it.

Thus, JUnit does not see the exception.
So when JMock flags a failure, our tests still pass.

A similar thing will happen in the deployed system, of course.

Is it possible to let Jess re-throw the exception?

We tried to find a flag to set on Jess, but could not find any.

We know that try/catch in Jess can install a handler, but we do not know how to 
wrap such try/catch when we call Rete.run() from Java.

Other suggestions?

Bye,
Kero.

__
Kero van Gelder
Software Engineer
Systems Creation
MiPlaza
Philips Research Europe
High Tech Campus 34.6.12 (WY61)
5656 AE Eindhoven
Tel: +31-40-27.47905
E-mail: kero.van.gel...@philips.com
http://www.miplaza.com/

The information contained in this message may be confidential and legally 
protected under applicable law. The message is intended solely for the 
addressee(s). If you are not the intended recipient, you are hereby notified 
that any use, forwarding, dissemination, or reproduction of this message is 
strictly prohibited and may be unlawful. If you are not the intended recipient, 
please contact the sender by return e-mail and destroy all copies of the 
original message.





--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
--------------------------------------------------------------------






--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
--------------------------------------------------------------------

Reply via email to