You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2004/05/25 10:42:55 UTC

DO NOT REPLY [Bug 16707] - IllegalArgumentException while calling an overloaded method

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=16707

IllegalArgumentException while calling an overloaded method





------- Additional Comments From posting02@mysign.ch  2004-05-25 08:42 -------
the bug appears only, if the call of foo is in a file
which is included by #parse. 

You can reproduce the bug with following files:

main template file:
#set ( $param = $someobj.getNull() )
#parse ( "includecall.vm" )<br>
#set ( $param = "a string" )
#parse ( "includecall.vm" )

includecall.vm:
$testobj.foo( $param )

class with the name someobj in the context:

public class VelocityCachingBug
{
    public VelocityCachingBug()
    {
    }

    public String foo ( Integer s )
    {
        return "Integer";
    }

    public String foo ( String i )
    {
        return "String";
    }

    public Object getNull()
    {
        return null;
    }
}

if you render the main template, the second call can't be found by velocity
because the parsed file is cached only once (as one single node). 

I don't think the solution to this is to cache every call in a parsed file (if
it's parsed more than once), because that can lead to much more memory use if
you have many parsed files (like we have...), which are mostly the same.

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