本文整理汇总了Java中org.mozilla.javascript.EvaluatorException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java EvaluatorException.getMessage方法的具体用法?Java EvaluatorException.getMessage怎么用?Java EvaluatorException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mozilla.javascript.EvaluatorException
的用法示例。
在下文中一共展示了EvaluatorException.getMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFilter
import org.mozilla.javascript.EvaluatorException; //导入方法依赖的package包/类
public void setFilter(String filter) throws ServiceException {
if (filter == null) {
filter = "";
}
if (!this.filter.equals(filter)) {
this.filter = filter;
if (filter.length() != 0) {
Context js_context = Context.enter();
try {
js_and.reset(filter);
js_or.reset(js_and.replaceAll(" && "));
filter = js_or.replaceAll(" || ");
js_filter = js_context.compileString(filter, "filter", 0, null);
} catch (EvaluatorException e) {
throw new ServiceException("Failed to compile JS filter : " + e.getMessage(), e);
} finally {
Context.exit();
}
} else {
js_filter = null;
}
bContinue = false;
}
}
示例2: addError
import org.mozilla.javascript.EvaluatorException; //导入方法依赖的package包/类
public void addError(EvaluatorException error)
{
++errorCount;
errors.append(errorCount);
errors.append(". ");
String message = error.getMessage();
errors.append(message);
errors.append(" at column ");
errors.append(error.columnNumber());
String lineSource = error.lineSource();
if (lineSource != null)
{
errors.append(" in line\n");
errors.append(lineSource);
}
errors.append("\n");
}
示例3: jsonToSdp
import org.mozilla.javascript.EvaluatorException; //导入方法依赖的package包/类
static String jsonToSdp(JSONObject json) throws InvalidDescriptionException {
synchronized (SdpProcessor.class) {
if (sInstance == null) {
sInstance = new SdpProcessor();
}
}
Context context = Context.enter();
context.setOptimizationLevel(-1);
context.setLanguageVersion(Context.VERSION_1_8);
try {
ScriptableObject scope = sInstance.getScope();
Object result = sInstance.getJsonToSdpFunction().call(context, scope, scope, new Object[]{json.toString()});
return "" + result;
} catch (EvaluatorException e) {
throw new InvalidDescriptionException("failed to parse sdp: " + e.getMessage(), e);
} finally {
Context.exit();
}
}
示例4: parseScript
import org.mozilla.javascript.EvaluatorException; //导入方法依赖的package包/类
protected AstRoot parseScript(String script){
CompilerEnvirons ce = new CompilerEnvirons();
ce.setRecordingComments(false);
ce.setStrictMode(true);
ce.setXmlAvailable(false);
final AstRoot root;
try {
root = new Parser(ce).parse(script,"S1RestrictedScript",1);
} catch (Throwable e) {
String message = "";
int line = 0;
int column = 0;
String m = null;
if(e instanceof EvaluatorException){
EvaluatorException ex = (EvaluatorException)e;
message = "Syntax error: "+ex.getMessage();
line = ex.getLineNumber()-1;
column = ex.getColumnNumber();
String arr [] = script.split("\n",-1);
m = (arr.length>line?(arr[line]):"");
}else{
message = e.getMessage();
}
throw new SyntaxException(m,line,column,message,e);
}
if(LOG.isDebugEnabled()){
LOG.debug(root.debugPrint());
}
return root;
}