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

IllegalArgumentException while calling an overloaded method

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 1.3-rc1
    • Fix Version/s: 1.5
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All
    • Bugzilla Id:
      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. includecall.vm
          0.0 kB
          mike
        2. velocity_patch.patch
          11 kB
          Llewellyn Falco
        3. velocitybug.vm
          0.1 kB
          mike
        4. VelocityCachingBug.java
          0.5 kB
          mike

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: