Author: mrdon Date: Sun Feb 20 18:48:51 2005 New Revision: 154615 URL: http://svn.apache.org/viewcvs?view=rev&rev=154615 Log: Removing most deprecations
Modified: struts/flow/trunk/src/java/org/apache/struts/flow/core/JavaScriptInterpreter.java Modified: struts/flow/trunk/src/java/org/apache/struts/flow/core/JavaScriptInterpreter.java URL: http://svn.apache.org/viewcvs/struts/flow/trunk/src/java/org/apache/struts/flow/core/JavaScriptInterpreter.java?view=diff&r1=154614&r2=154615 ============================================================================== --- struts/flow/trunk/src/java/org/apache/struts/flow/core/JavaScriptInterpreter.java (original) +++ struts/flow/trunk/src/java/org/apache/struts/flow/core/JavaScriptInterpreter.java Sun Feb 20 18:48:51 2005 @@ -30,7 +30,6 @@ import org.mozilla.javascript.Function; import org.mozilla.javascript.JavaScriptException; import org.mozilla.javascript.NativeArray; -import org.mozilla.javascript.PropertyException; import org.mozilla.javascript.*; import org.mozilla.javascript.ScriptRuntime; import org.mozilla.javascript.Scriptable; @@ -141,17 +140,16 @@ java.awt.Toolkit.getDefaultToolkit().getScreenSize(); size.width *= 0.75; size.height *= 0.75; - db.setSize(size); + db.setSize(size.width, size.height); db.setExitAction( new Runnable() { public void run() { db.setVisible(false); } }); - db.setOptimizationLevel(OPTIMIZATION_LEVEL); db.setVisible(true); debugger = db; - Context.addContextListener(debugger); + ContextFactory.getGlobal().addListener(debugger); } return debugger; } @@ -201,7 +199,6 @@ getDebugger().doBreak(); } Context context = Context.enter(); - context.setOptimizationLevel(OPTIMIZATION_LEVEL); context.setCompileFunctionsWithDynamicScope(true); context.setGeneratingDebug(true); @@ -234,8 +231,7 @@ [EMAIL PROTECTED] JavaScriptException If anything goes wrong */ protected void initScope(Context context, JSGlobal scope) throws IllegalAccessException, - PropertyException, InstantiationException, InvocationTargetException, NotAFunctionException, - ClassDefinitionException, JavaScriptException { + InstantiationException, InvocationTargetException, JavaScriptException { // Access to the log ScriptableObject.defineClass(scope, JSLog.class); @@ -247,12 +243,12 @@ // Define some functions on the top level scope String[] names = {"print"}; - try { + //try { scope.defineFunctionProperties(names, JSGlobal.class, ScriptableObject.DONTENUM); - } catch (PropertyException e) { - throw new Error(e.getMessage()); - } + //} catch (PropertyException e) { + // throw new Error(e.getMessage()); + //} // Define some global variables in JavaScript Object args[] = {}; @@ -328,7 +324,7 @@ protected Script reallyCompileScript(Context cx, File source) throws IOException { Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(source))); - Script compiledScript = cx.compileReader(scope, reader, + Script compiledScript = cx.compileReader(reader, source.getAbsolutePath(), 1, null); return compiledScript; @@ -386,10 +382,6 @@ // this will produce a better error message } ScriptRuntime.call(context, callFun, thrScope, callFunArgs, thrScope); - } catch (PropertyException ex) { - throw new FlowException("Unable to define script property", ex); - } catch (NotAFunctionException ex) { - throw new FlowException("Unable to define script property", ex); } catch (IOException ex) { throw new FlowException("Unable to compile scripts", ex); } catch (JavaScriptException ex) { @@ -401,12 +393,12 @@ } catch (EcmaError ee) { String msg = ToolErrorReporter.getMessage( "msg.uncaughtJSException", ee.toString()); - if (ee.getSourceName() != null) { + if (ee.sourceName() != null) { Context.reportRuntimeError(msg, - ee.getSourceName(), - ee.getLineNumber(), - ee.getLineSource(), - ee.getColumnNumber()); + ee.sourceName(), + ee.lineNumber(), + ee.lineSource(), + ee.columnNumber()); } else { Context.reportRuntimeError(msg); } @@ -484,12 +476,12 @@ throw new RuntimeException(ee.getMessage(), ee); } catch (EcmaError ee) { String msg = ToolErrorReporter.getMessage("msg.uncaughtJSException", ee.toString()); - if (ee.getSourceName() != null) { + if (ee.sourceName() != null) { Context.reportRuntimeError(msg, - ee.getSourceName(), - ee.getLineNumber(), - ee.getLineSource(), - ee.getColumnNumber()); + ee.sourceName(), + ee.lineNumber(), + ee.lineSource(), + ee.columnNumber()); } else { Context.reportRuntimeError(msg); } @@ -517,7 +509,7 @@ [EMAIL PROTECTED] IOException If anything goes wrong */ public Scriptable enterContext(org.apache.commons.chain.Context chainCtx) - throws JavaScriptException, PropertyException, NotAFunctionException, IOException { + throws JavaScriptException, IOException { Context context = Context.enter(); context.setOptimizationLevel(OPTIMIZATION_LEVEL); context.setGeneratingDebug(true); @@ -623,7 +615,7 @@ */ protected void setupContext(Context context, Scriptable thrScope, org.apache.commons.chain.Context chainCtx) - throws PropertyException, NotAFunctionException, JavaScriptException { + throws JavaScriptException { // Put in the thread scope the context object, which gives access // to the interpreter object and the chain context --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]