Thanks, Serge.  I'd pulled up the code and was really quite puzzled.
Sounds like kind of a neat approach you are taking.

WILL

On Thu, Jul 3, 2008 at 1:18 PM, Serge Knystautas <[EMAIL PROTECTED]> wrote:
> Wow, figured this one out. :(  I doubt anyone else will hit this, but
> wanted to post it so nobody else wastes their time on this.
>
> The issue is that when the Macro directive initializes itself, when it
> comes across a macro with args, it creates a VMProxyArg.  For reasons
> I don't (need to) grasp, it creates some temporary velocity code that
> uses the Include directive and does a quick parse/evaluate on it.
> Once I re-enabled the include directive, things worked again.
>
> --
> Serge Knystautas
> Lokitech >> software . strategy . design >> http://www.lokitech.com
> p. 301.656.5501
> e. [EMAIL PROTECTED]
>
> On Thu, Jul 3, 2008 at 1:28 PM, Serge Knystautas <[EMAIL PROTECTED]> wrote:
>> This is a pretty far out question, but maybe someone could point me in
>> the right direction.
>>
>> As I mentioned a few weeks back, I realized the ResourceLoader concept
>> doesn't fit my CMS, so I began to access the core API.  I basically
>> completely rewrote my own RuntimeInstance (my class implements
>> RuntimeServices) and just about everything I need works... VTL is
>> found, parsed, rendered, context variables work, foreach directive,
>> etc...
>>
>> One issue I have is with Macro arguments.  The macro directive is
>> enabled, initialized, my vmfactory works, and I can create and use 0
>> argument macros just fine.  It also works that if I define a 1
>> argument macro and use the macro with 2 arguments, it gives the
>> appropriate error that I passed the wrong number of arguments (I have
>> velocimacro.arguments.strict true).
>>
>> However, when I create a macro with more than 0 arguments and use it
>> correctly, I get this stack trace I can't understand.  I must be not
>> initializing something somehow, but it's so many levels removed, I'm
>> not quite sure what's going on.
>>
>> java.lang.NullPointerException
>>         at 
>> org.apache.velocity.runtime.parser.node.SimpleNode.jjtGetChild(SimpleNode.java:172)
>>         at 
>> org.apache.velocity.runtime.directive.VMProxyArg.setup(VMProxyArg.java:409)
>>         at 
>> org.apache.velocity.runtime.directive.VMProxyArg.<init>(VMProxyArg.java:136)
>>         at 
>> org.apache.velocity.runtime.directive.VelocimacroProxy.setupProxyArgs(VelocimacroProxy.java:401)
>>         at 
>> org.apache.velocity.runtime.directive.VelocimacroProxy.setupMacro(VelocimacroProxy.java:321)
>>         at 
>> org.apache.velocity.runtime.directive.VelocimacroProxy.init(VelocimacroProxy.java:309)
>>         at 
>> org.apache.velocity.runtime.parser.node.ASTDirective.init(ASTDirective.java:134)
>>         at 
>> org.apache.velocity.runtime.parser.node.SimpleNode.init(SimpleNode.java:285)
>>
>> The VTL in question is:
>>
>> =======================================================
>> #macro (stuff $arg1)
>> Hello stuff $arg1
>> #end
>>
>> #macro (foo)
>> Foooooo
>> #end
>>
>> #foo()  ## This works!
>>
>> #stuff("foo")  ## This gives the above stack trace
>> =======================================================
>>
>> If anyone has any pointers on what this might be looking for, I would
>> greatly appreciate it.
>>
>> --
>> Serge Knystautas
>> Lokitech >> software . strategy . design >> http://www.lokitech.com
>> p. 301.656.5501
>> e. [EMAIL PROTECTED]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Forio Business Simulations

Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to