You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bsf-dev@jakarta.apache.org by "Scott Cytacki (JIRA)" <ji...@apache.org> on 2007/11/29 18:29:43 UTC

[jira] Created: (BSF-10) wrapping java objects which are passed to BSF call method in javascript engine

wrapping java objects which are passed to BSF call method in javascript engine
------------------------------------------------------------------------------

                 Key: BSF-10
                 URL: https://issues.apache.org/jira/browse/BSF-10
             Project: BSF
          Issue Type: Improvement
    Affects Versions: BSF-2.4
            Reporter: Scott Cytacki


The BSF 2.4.0 javascript engine does not wrap the arguments that are passed in
to the call method.  This means for example that in javascript the argument
objects will not be "==" to the same object if it is retrieved through live
connect.  

This can be fixed by using the context.getWrapFactory().wrap method.  So adding
the following code to the JavaScriptEngine fixes this:

            // need to wrap the passed in objects the same as if they were handled by live connect
            if(args != null){
            	WrapFactory wrapFactory = cx.getWrapFactory();
            	for(int i=0; i<args.length; i++){
            		args[i] = wrapFactory.wrap(cx, global, args[i], null);
            	}
            }

The code above is licensed under the Apache License 2.0


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-dev-help@jakarta.apache.org