jakarta-bsf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From orlikow...@apache.org
Subject cvs commit: jakarta-bsf/src/bsf-2.3/bsf/src/org/apache/bsf/engines/javascript JavaScriptEngine.java
Date Thu, 13 Feb 2003 08:25:30 GMT
orlikowski    2003/02/13 00:25:30

  Modified:    src/bsf-2.3/bsf/src/org/apache/bsf/engines/javascript
                        JavaScriptEngine.java
  Log:
  Apply patch from Fabrício Matheus Gonçalves.
  
  Fabrício's patch changes declareBean() in the Rhino engine to not wrap
  those classes that are natively handled by the Scriptable interface.
  
  Revision  Changes    Path
  1.3       +10 -4     jakarta-bsf/src/bsf-2.3/bsf/src/org/apache/bsf/engines/javascript/JavaScriptEngine.java
  
  Index: JavaScriptEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/bsf-2.3/bsf/src/org/apache/bsf/engines/javascript/JavaScriptEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaScriptEngine.java	7 Nov 2002 01:49:12 -0000	1.2
  +++ JavaScriptEngine.java	13 Feb 2003 08:25:30 -0000	1.3
  @@ -193,11 +193,17 @@
       }
   
       public void declareBean(BSFDeclaredBean bean) throws BSFException {
  -        // Must wrap non-scriptable objects before presenting to Rhino
  -        Scriptable wrapped = Context.toObject(bean.bean, global);
  -        global.put(bean.name, global, wrapped);
  +        if ((bean.bean instanceof Number) ||
  +            (bean.bean instanceof String) ||
  +            (bean.bean instanceof Boolean)) {
  +            global.put(bean.name, global, bean.bean);
  +        } else {
  +            // Must wrap non-scriptable objects before presenting to Rhino
  +            Scriptable wrapped = Context.toObject(bean.bean, global);
  +            global.put(bean.name, global, wrapped);
  +        }
       }
  -
  +    
       /**
        * This is used by an application to evaluate a string containing
        * some expression.
  
  
  

Mime
View raw message