Caching same results

27 views
Skip to first unread message

Barry Jacobs

unread,
May 17, 2016, 4:26:06 AM5/17/16
to mozilla-rhino
Hi, We are using rhino server-side in a bean. We have noticed that after the first run our results are cached even after we exit from the context.
Can someone point out our logical-error??
hereby the code:



//Rhino engine Ok.

Context cx = Context.enter();

Scriptable scope = cx.initStandardObjects();


//Load javascript factory with javascript functions from file, stringinput and paraminput

 String jsResult = "";

 try {


  cx.evaluateString(scope, javascriptcode, "jsScript", 1, null);
 
  Function fct = (Function)scope.get(jsfunctionName, scope);

  Object result = fct.call(cx, scope, scope, new Object[]{jsfunctionArguments});


 if(isDebug()) {

   System.out.println(cx.jsToJava(result, String.class));

  };

 jsResult = (String) cx.jsToJava(result, String.class);


 } catch (org.mozilla.javascript.EcmaError ex) {

  throw new PipeRunException(this, "org.mozilla.javascript.EcmaError -> ", ex);

//System.out.println(ex.getMessage());

  }finally {

 cx.exit();

}

//Use the result

 if (!(jsResult instanceof String)) {


 }else{

  if((String)jsResult != null){

   stringResult = (String)jsResult;

  }

 }


thanks,


Black



Reply all
Reply to author
Forward
0 new messages