/** * @deprecated Use {@link RhinoException#sourceName()} from the super class. */ public String getSourceName() { return sourceName(); }
/** * @deprecated Use {@link RhinoException#sourceName()} from the super class. */ public String getSourceName() { return sourceName(); }
/** * @deprecated Use {@link RhinoException#sourceName()} from the super class. */ public String getSourceName() { return sourceName(); }
/** * @deprecated Use {@link RhinoException#sourceName()} from the super class. */ public String getSourceName() { return sourceName(); }
/** * @deprecated Use {@link RhinoException#sourceName()} from the super class. */ public String getSourceName() { return sourceName(); }
/** * @deprecated Use {@link RhinoException#sourceName()} from the super class. */ @Deprecated public String getSourceName() { return sourceName(); }
public Object evaluateJavascript(String javascript) throws Exception { try { Object result = cx.evaluateString(scope, javascript, "main", 1, null); return result; } catch(EcmaError e) { for(JavascriptRunnerListener listener : listeners){ listener.runtimeError(e.details(), e.sourceName(), e.lineNumber()); } throw e; } }
public Location getLocation(Object obj, String description) { if (obj instanceof EcmaError) { EcmaError ex = (EcmaError)obj; if (ex.sourceName() != null) { return new LocationImpl(ex.getName(), ex.sourceName(), ex.lineNumber(), ex.columnNumber()); } else { return Location.UNKNOWN; } } else if (obj instanceof JavaScriptException) { JavaScriptException ex = (JavaScriptException)obj; if (ex.sourceName() != null) { return new LocationImpl(description, ex.sourceName(), ex.lineNumber(), -1); } else { return Location.UNKNOWN; } } return null; } };
@Override public Object eval(Reader reader, ScriptContext context) throws ScriptException { String filename = (String) get(ScriptEngine.FILENAME); if (filename == null) { filename = "<Unknown Source>"; } Object result; EngineScope scope = new EngineScope(context); Global global = getGlobal(); scope.setParentScope(global); scope.setPrototype(global); Context cx = enterContext(); try { scope.put("exports", scope, cx.newObject(global)); result = cx.evaluateReader(scope, reader, filename, 1, null); } catch (EcmaError e) { throw new ScriptException( e.getMessage(), e.sourceName(), e.lineNumber(), e.columnNumber()); } catch (Exception e) { throw new ScriptException(e); } finally { Context.exit(); } return result; }