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]

Reply via email to