blob: 95242b86900d6befeedbb1633a0a3d54c9140d3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package org.uscxml.tests;
import org.uscxml.Interpreter;
import org.uscxml.InterpreterException;
public class TestExceptions {
public static void main(String[] args) throws InterpreterException {
System.load("/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava64.jnilib");
String xml =
"<scxml datamodel=\"ecmascript\">" +
" <state id=\"start\">" +
" <transition target=\"done\" />" +
" </state>" +
" <final id=\"done\" />" +
"</scxml>";
if (false) {
// datamodel not available before first step -> dies with segfault
Interpreter interpreter = Interpreter.fromXML(xml);
System.out.println(interpreter.getDataModel().evalAsString("'FOO'"));
}
if (false) {
// datamodel is available but syntactic ecmascript exception is not propagated
Interpreter interpreter = Interpreter.fromXML(xml);
interpreter.step();
System.out.println(interpreter.getDataModel().evalAsString("'FOO' / qwer"));
}
}
}
|