Velocity
  1. Velocity
  2. VELOCITY-132

IllegalArgumentException while calling an overloaded method

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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

      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

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

        Issue Links

          Activity

          MySign created issue -
          Jeff Turner made changes -
          Field Original Value New Value
          issue.field.bugzillaimportkey 16707 12315002
          Will Glass-Husain made changes -
          Bugzilla Id 16707
          Fix Version/s 1.4 [ 12310249 ]
          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
          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
          Assignee Velocity-Dev List [ velocity-dev@jakarta.apache.org ]
          Fix Version/s 1.5 [ 12310253 ]
          Environment Operating System: All
          Platform: All
          Operating System: All
          Platform: All
          Will Glass-Husain made changes -
          Link This issue is duplicated by VELOCITY-389 [ VELOCITY-389 ]
          Will Glass-Husain made changes -
          Priority Blocker [ 1 ] Major [ 3 ]
          Bugzilla Id 16707
          Llewellyn Falco made changes -
          Attachment velocity_patch.patch [ 12321077 ]
          mike made changes -
          Attachment includecall.vm [ 12321685 ]
          Attachment VelocityCachingBug.java [ 12321686 ]
          Attachment velocitybug.vm [ 12321684 ]
          Will Glass-Husain made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Invalid [ 6 ]
          Henning Schmiedehausen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Mark Thomas made changes -
          Workflow jira [ 12325007 ] Default workflow, editable Closed status [ 12551838 ]
          Mark Thomas made changes -
          Workflow Default workflow, editable Closed status [ 12551838 ] jira [ 12552639 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              MySign
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development