[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-dev
Subject:    DO NOT REPLY [Bug 14711] New:  -
From:       bugzilla () apache ! org
Date:       2002-11-20 16:32:28
[Download RAW message or body]

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14711>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14711

Methods cannot be invoked from vm

           Summary: Methods cannot be invoked from vm
           Product: Velocity
           Version: 1.3-rc1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Source
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: Alexander.Veit@unitedplanet.de


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

--
To unsubscribe, e-mail:   <mailto:velocity-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-dev-help@jakarta.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic