Example usage for javax.script ScriptException printStackTrace

List of usage examples for javax.script ScriptException printStackTrace

Introduction

In this page you can find the example usage for javax.script ScriptException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.rhq.enterprise.client.commands.ScriptCommand.java

public ScriptEngine getScriptEngine() {
    if (jsEngine == null) {
        try {// w ww .  j  a v a2s  . c o  m
            jsEngine = ScriptEngineFactory.getScriptEngine("JavaScript",
                    new PackageFinder(Arrays.asList(getLibDir())), null);
        } catch (ScriptException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    return jsEngine;
}

From source file:vo.SPage.java

public SPage(int p, Long i, String s, String cf, String ssf, String ef, String gf, String o, String ot,
        List<TagListVo> is, List<TagListVo> ss, List<ExpertListVO> experts) {
    super();/*  www . j  av a 2 s. co  m*/
    this.p = p;
    this.cf = cf;
    if (StringUtils.isNotBlank(this.cf)) {
        try {
            this.encf = SemUtils.getEngine().eval("encodeURIComponent('" + cf + "')").toString();
        } catch (ScriptException e) {
            e.printStackTrace();
        }
    }
    this.ssf = ssf;
    this.ef = ef;
    this.gf = gf;
    this.o = o;
    this.ot = ot;
    this.i = i;
    this.s = s;
    this.is = is;
    this.ss = ss;
    this.experts = experts;
}

From source file:vo.expertpage.EPage.java

public void setFt(String ft) {
    if (StringUtils.isNotBlank(ft)) {
        try {/*from  w  ww .  j a  v  a 2  s .c  om*/
            this.enft = engine.eval("encodeURIComponent('" + ft + "')").toString();
        } catch (ScriptException e) {
            e.printStackTrace();
        }
    }
    this.ft = ft;
}

From source file:vo.expertpage.EPage.java

public void setCf(String cf) {
    if (StringUtils.isNotBlank(cf)) {
        try {/* www .j  a va 2  s  . c  o m*/
            this.encf = engine.eval("encodeURIComponent('" + cf + "')").toString();
        } catch (ScriptException e) {
            e.printStackTrace();
        }
    }
    this.cf = cf;
}

From source file:vo.expertpage.EPage.java

public String getCfHref(String cf) {
    String uricf = null;/*from   ww  w .j av  a  2  s  .c  o  m*/
    try {
        uricf = engine.eval("encodeURIComponent('" + cf + "')").toString();
    } catch (ScriptException e) {
        e.printStackTrace();
    }
    StringBuffer urlbb = new StringBuffer(routes.ExpertApp.search().url());
    urlbb.append("?p=1|1&type=html");
    if (StringUtils.isNotBlank(this.enft))
        urlbb.append("&ft=").append(this.enft);
    if (StringUtils.isNotBlank(uricf))
        urlbb.append("&cf=").append(uricf);
    if (StringUtils.isNotBlank(this.ef))
        urlbb.append("&ef=").append(this.ef);
    if (StringUtils.isNotBlank(this.ssf))
        urlbb.append("&ssf=").append(this.ssf);
    if (StringUtils.isNotBlank(this.gf))
        urlbb.append("&gf=").append(this.gf);
    if (StringUtils.isNotBlank(this.o))
        urlbb.append("&o=").append(this.o);
    if (StringUtils.isNotBlank(this.ot))
        urlbb.append("&ot=").append(this.ot);
    return urlbb.toString();
}

From source file:com.qframework.core.ServerkoParse.java

ServerkoParse(GameonApp theApp) {

    mApp = theApp;/*from  w  w  w  . j  a v a2 s.  com*/
    mMgr = new ScriptEngineManager();
    mScriptView = mMgr.getEngineByName("JavaScript");
    String scr = new String(
            "console ={msgs: new Array(), log: function(msg)   { console.msgs.push(msg); },info: function(msg) { console.msgs.push(msg); },warn : function(msg) { console.msgs.push(msg); },error: function(msg) { console.msgs.push(msg); },shift: function() { return console.msgs.shift(); }};");
    try {
        mScriptView.eval(scr);
    } catch (ScriptException e) {
        e.printStackTrace();
    }
}

From source file:com.ikanow.infinit.e.harvest.enrichment.custom.UnstructuredAnalysisHarvester.java

public void intializeScriptEngine(SourcePojo source, UnstructuredAnalysisConfigPojo uap) {
    if (null == engine) {
        //use the passed in sah one if possible
        if (null != this.get_sahEngine()) {
            engine = this.get_sahEngine();
        } else if (null == factory) //otherwise create our own
        {/*w w w  . ja  v a 2 s . com*/
            factory = new ScriptEngineManager();
            engine = factory.getEngineByName("JavaScript");
            //grab any json cache and make it available to the engine
        }
        //once engine is created, do some initialization
        if (null != engine) {
            if (null != source) {
                loadLookupCaches(uap.getCaches(), source.getCommunityIds(), source.getOwnerId());
                List<String> scriptFiles = null;
                if (null != uap.getScriptFiles()) {
                    scriptFiles = Arrays.asList(uap.getScriptFiles());
                }
                loadGlobalFunctions(scriptFiles, uap.getScript());
            }
            if (null == parsingScript) {
                parsingScript = JavaScriptUtils.generateParsingScript();
            }
            try {
                securityManager.eval(engine, parsingScript);
            } catch (ScriptException e) { // Just do nothing and log
                e.printStackTrace();
                logger.error("intializeScriptEngine: " + e.getMessage());
            }

        }
    } //end start engine up      

}