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 Fabrício Matheus Gonçalves <fm...@bigbross.com> on 2003/01/28 18:58:25 UTC

JavaScriptEngine.declareBean bug?

Hi

Im glad bsf is now at jakarta.
So my problem is when i declare some Number, String or Boolean,
that appear into script as object.

I think the problem is below line, it is wrapping all objects instead of
just the non-scriptable ones. We could make intanceof of the
bean.type to avoid wrap Number, String e Boolean.

    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);
    }


PS: I could send a patch, if you want.