[ 
https://issues.apache.org/jira/browse/VELOCITY-115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Henning Schmiedehausen closed VELOCITY-115.
-------------------------------------------


> Methods cannot be invoked from vm
> ---------------------------------
>
>                 Key: VELOCITY-115
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-115
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.3-rc1
>         Environment: Operating System: All
> Platform: PC
>            Reporter: Alexander Veit
>         Assigned To: Velocity-Dev List
>            Priority: Critical
>             Fix For: 1.4
>
>
> Method findMethod(String name, Object[] params) of 
> org.apache.velocity.util.introspection.ClassMap
> fails under some circumstances.
> -->
> Twonk twonk = calcDistance( params, parameterTypes ) is null 
> -->
> private Twonk MethodMap.calcDistance( Object[] set, Class[] base )
> {
>       //...
>     if ( !base[i].isAssignableFrom( set[i].getClass() ))
>         return null;  // place breakpoint here
>       //...
> }
> --- IOrder.java ---
> package velocitybug;
> public interface IOrder
> {
>       public void say();
> }
> -------------------
> --- TheOrder.java ---
> package velocitybug;
> public class TheOrder implements IOrder
> {
>       public TheOrder()
>       {
>       }
>       public void say()
>       {
>               System.out.println("Hello");
>       }
> }
> ---------------------
> --- TheCollection.java ---
> package velocitybug;
> public class TheCollection
> {
>       public TheCollection()
>       {
>       }
>       
>       public void aWorks(String s, int i)
>       {
>               System.out.println("a works");
>       }
>       
>       public void bWorks(IOrder o, String s)
>       {
>               System.out.println("b works");
>       }
>       
>       public void doesNotWork(IOrder o, int i)
>       {
>               System.out.println("does not work");
>       }
> }
> ---------------------------
> --- invokeBug ---
>       public void invokeBug()
>       {
>               VelocityContext l_context;
>               Template        l_template;
>               PrintWriter     l_writer;
>               try
>               {
>                       Velocity.init("velocity.properties");
>                       l_context = new VelocityContext();
>                       l_context.internalPut("TheOrder", new TheOrder());
>                       l_context.internalPut("TheCollection", new TheCollection
> ());
>                       l_template = Velocity.getTemplate("VelocityBug.vm");
>                       l_writer   = new PrintWriter(System.out);
>                       l_template.merge(l_context, l_writer);
>                       l_writer.flush();
>                       l_writer.close();
>               }
>               catch (Exception l_e)
>               {
>                       l_e.printStackTrace();
>               }
>       }
> -------------------
> --- VelocityBug.vm ---
> $TheCollection.aWorks("Hello", 4711)
> $TheCollection.bWorks($TheOrder, "World")
> $TheCollection.doesNotWork($TheOrder, 4712)
> ----------------------

-- 
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