Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-132

IllegalArgumentException while calling an overloaded method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 1.3-rc1
    • 1.5
    • Engine
    • None
    • Operating System: All
      Platform: All
    • 16707

    Description

      If there are two methods with the same name and different parameters like:
      public class myClass
      {
      public String foo ( Integer intObj );
      public String foo ( String str );
      }

      and a velocity template like this

      $myObj.foo( $someObj.getNull() )
      $myObj.foo( $str )

      while $someObj.getNull() returns null and $str is a java.lang.String object
      with a String like 'test'. Because velocity caches the first method with the
      Integer argument on calling with the parameter null (which isn't of course of
      any type/class) the call fails with the String argument, because velocity tries
      to call the foo( Integer intObj )!

      In the velocity log appears a IllegalArgumentException which is right, but
      velocity should call the right method!

      mike

      Attachments

        1. velocity_patch.patch
          11 kB
          Llewellyn Falco
        2. VelocityCachingBug.java
          0.5 kB
          mike
        3. includecall.vm
          0.0 kB
          mike
        4. velocitybug.vm
          0.1 kB
          mike

        Issue Links

          Activity

            People

              Unassigned Unassigned
              posting02@mysign.ch MySign
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: