cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject Re: call a function not in global object in <map:call >
Date Sun, 19 Nov 2006 17:21:21 GMT

On Nov 19, 2006, at 7:11 AM, Jeremy Quinn wrote:

> Hi Guys
>
> I am trying this patch in 2_1_10-dev and it does not compile :

Jeremy, thanks for trying the patch.  Sorry for the bad code, I need to  
get up on the learning curve of building trunk :-/  Anyway, see  
below...

> compile-core:
> Compiling 1 source file to  
> /Users/Shared/Development/Checkouts/Apache/Cocoon/Cocoon_2_1_X/build/ 
> cocoon/classes
> /Users/Shared/Development/Checkouts/Apache/Cocoon/Cocoon_2_1_X/src/ 
> java/org/apache/cocoon/components/flow/javascript/fom/ 
> FOM_JavaScriptInterpreter.java:750: cannot find symbol
> symbol  : method  
> compileString(java.lang.String,<nulltype>,int,<nulltype>)
> location: class org.mozilla.javascript.Context
>                         fun = context.compileString (funName, null, 1,  
> null).exec (context, thrScope);
>                                      ^
>
> The method signature looks correct according to this:
> 	http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/ 
> Context.html
>
> Is this another possible issue with our customised Rhino ?

Yeah, I think it must be.  I knew that trunk uses a newer Rhino than  
2.1.10, and I expected the API to be as described in your reference  
above, but I guess it is not.  To fix this, just use the old  
compileReader() method instead.  I think you can probably just use the  
code from the 2.1.10 version of my patch... see earlier in that thread  
(but watch out, I posted two versions of the patch, and the first one  
was BAD... use the second).

Since there has been no outcry of horror and disgust at my patch, I  
think I will go ahead and JIRA it up :-)

My first attempt at this (before any of the patches I posted) was to  
iterate through the path, e.g. "some.package.has.my.function", and  
drill down through the object graph with getProperty().  I couldn't  
figure out how to make that work, because getProperty needs a  
ScriptableObject but it only returns a plain old Object.  Whatever :-).  
  So then I thought, "let's just Rhino do it", which seemed a little  
hacky at the time, but maybe no! :-).  It seems safe — if Rhino doesn't  
like anything, then you always just get the "function not found" error.

Have fun,
—ml—


Mime
View raw message