[ 
https://issues.apache.org/jira/browse/VELOCITY-651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652880#action_12652880
 ] 

sschmid edited comment on VELOCITY-651 at 12/3/08 10:22 AM:
-------------------------------------------------------------------

Well, at least under Velocity 1.4 and 1.5 the [] notation worked for arrays. 
This notation is also shown in a corresponding example at 
http://velocity.apache.org/tools/releases/1.4/struts/MessageTool.html
After looking at it a little more, the MessageTool contains also an overloaded 
method with get(String, List), so it should work anyway... 

Following, the interesting part of the stack trace:

java.lang.IllegalArgumentException: wrong number of arguments
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
        at 
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
        at 
org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
        at 
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
        at 
org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:339)
        at 
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at org.apache.velocity.runtime.directive.Parse.render(Parse.java:262)
        at 
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:176)
        at 
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
        at 
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at 
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
        at 
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
        at 
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at 
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
        at 
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at org.apache.velocity.runtime.directive.Parse.render(Parse.java:262)
        at 
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:176)
        at 
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at org.apache.velocity.Template.merge(Template.java:328)

Greetings,
Stephan


      was (Author: sschmid):
    Well, at least under Velocity 1.4 and 1.5 the [] notation worked for 
arrays. 
This notation is also shown in a corresponding example at 
http://velocity.apache.org/tools/releases/1.4/struts/MessageTool.html

Following, the interesting part of the stack trace:

java.lang.IllegalArgumentException: wrong number of arguments
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
        at 
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
        at 
org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
        at 
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
        at 
org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:339)
        at 
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at org.apache.velocity.runtime.directive.Parse.render(Parse.java:262)
        at 
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:176)
        at 
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
        at 
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at 
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
        at 
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
        at 
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at 
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
        at 
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at org.apache.velocity.runtime.directive.Parse.render(Parse.java:262)
        at 
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:176)
        at 
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
        at org.apache.velocity.Template.merge(Template.java:328)

Greetings,
Stephan

  
> Velocity 1.6 does not work with Struts MessageTool 1.4
> ------------------------------------------------------
>
>                 Key: VELOCITY-651
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-651
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6
>         Environment: Velocity 1.6, Struts MessageTool 1.4, Struts 1.2.9, Java 
> 1.6_10
>            Reporter: Stephan Schmid
>
> The org.apache.velocity.tools.struts.MessageTool of VelocityTools version 1.4 
> contains a method signature of String get(String key, Object args[]).
> With Velocity 1.5, one could use a Struts resource, such as
> test1=this is a {0}
> in a Velocity template with
> $text.get('test1', ['TEST'])
> that would render the text
> this is a TEST
> Unfortunately, since the released version 1.6 I get the following exception: 
> Invocation of method 'get' in class 
> org.apache.velocity.tools.struts.MessageTool threw exception 
> java.lang.IllegalArgumentException: wrong number of arguments at .. 
> The setting of the property runtime.references.strict has no influence.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to