cjolif 02/01/30 09:42:27
Modified: sources/org/apache/batik/script/rhino RhinoInterpreter.java
Log:
Rhino1.5R2 -> Rhino1.5R3 compatibility problem
Revision Changes Path
1.8 +10 -6
xml-batik/sources/org/apache/batik/script/rhino/RhinoInterpreter.java
Index: RhinoInterpreter.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/script/rhino/RhinoInterpreter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- RhinoInterpreter.java 8 Oct 2001 15:04:39 -0000 1.7
+++ RhinoInterpreter.java 30 Jan 2002 17:42:27 -0000 1.8
@@ -35,7 +35,7 @@
* A simple implementation of <code>Interpreter</code> interface to use
* Rhino ECMAScript interpreter.
* @author <a href="mailto:[EMAIL PROTECTED]">Christophe Jolif</a>
- * @version $Id: RhinoInterpreter.java,v 1.7 2001/10/08 15:04:39 cjolif Exp $
+ * @version $Id: RhinoInterpreter.java,v 1.8 2002/01/30 17:42:27 cjolif Exp $
*/
public class RhinoInterpreter implements Interpreter {
private static String[] TO_BE_IMPORTED = {
@@ -75,8 +75,10 @@
context = Context.enter();
try {
// init std object with an importer
+ // building the importer automatically initialize the
+ // context with it since Rhino1.5R3
ImporterTopLevel importer = new ImporterTopLevel(context);
- globalObject = (ScriptableObject)context.initStandardObjects(importer);
+ globalObject = importer;
// import Java lang package & DOM Level 2 & SVG DOM packages
NativeJavaPackage[] p= new NativeJavaPackage[TO_BE_IMPORTED.length];
for (int i = 0; i < TO_BE_IMPORTED.length; i++) {
@@ -113,8 +115,7 @@
* value of the last expression evaluated in the script.
*/
public Object evaluate(Reader scriptreader)
- throws InterpreterException, IOException
- {
+ throws InterpreterException, IOException {
Object rv = null;
Context ctx = Context.enter(context);
try {
@@ -154,8 +155,8 @@
* value of the last expression evaluated in the script.
*/
public Object evaluate(String scriptstr)
- throws InterpreterException
- {
+ throws InterpreterException {
+ System.out.println("evaluate "+scriptstr);
Context ctx = Context.enter(context);
Script script = null;
Entry et = null;
@@ -198,6 +199,8 @@
}
Object rv = null;
try {
+ System.out.println("ctx "+ctx);
+ System.out.println("global "+globalObject);
rv = script.exec(ctx, globalObject);
} catch (JavaScriptException e) {
// exception from JavaScript (possibly wrapping a Java Ex)
@@ -214,6 +217,7 @@
-1, -1);
} catch (RuntimeException re) {
// other RuntimeExceptions
+ re.printStackTrace();
throw new InterpreterException(re, re.getMessage(), -1, -1);
} finally {
Context.exit();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]