Author: nbubna
Date: Wed Dec  3 15:14:34 2008
New Revision: 723123

URL: http://svn.apache.org/viewvc?rev=723123&view=rev
Log:
merge trunk changes relevant to this branch

Modified:
    velocity/engine/branches/1.6.x/build/build.xml
    velocity/engine/branches/1.6.x/src/changes/changes.xml
    
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/util/introspection/MethodMap.java
    
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/util/introspection/UberspectImpl.java
    
velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/VarargMethodsTestCase.java

Modified: velocity/engine/branches/1.6.x/build/build.xml
URL: 
http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/build/build.xml?rev=723123&r1=723122&r2=723123&view=diff
==============================================================================
--- velocity/engine/branches/1.6.x/build/build.xml (original)
+++ velocity/engine/branches/1.6.x/build/build.xml Wed Dec  3 15:14:34 2008
@@ -1085,6 +1085,9 @@
       and the non-dep jar, source jar, javadoc jar, pom and respective md5, 
sha1 and asc files should be copied into 
         
/www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/velocity/velocity/${version}/
 
+    * Remove older releases of the same grade as this one (alpha, beta, final) 
from
+        /www/www.apache.org/dist/velocity/engine
+
     * Tag the release in SVN with a command such as:
         svn copy -m "Release Engine ${version}" 
https://svn.apache.org/repos/asf/velocity/engine/trunk \
            https://svn.apache.org/repos/asf/velocity/engine/tags/${version}

Modified: velocity/engine/branches/1.6.x/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/src/changes/changes.xml?rev=723123&r1=723122&r2=723123&view=diff
==============================================================================
--- velocity/engine/branches/1.6.x/src/changes/changes.xml (original)
+++ velocity/engine/branches/1.6.x/src/changes/changes.xml Wed Dec  3 15:14:34 
2008
@@ -25,7 +25,17 @@
   </properties>
 
   <body>
-    <release version="1.6" date="In Subversion">
+
+    <release version="1.6.1" date="In Subversion">
+
+      <action type="fix" dev="nbubna" issue="VELOCITY-651" due-to="Stephan 
Schmid">
+          Fix vararg bugs when calling overloaded methods like 
get(String,String,Object[])
+          and get(String,List). (e.g. in VelocityStruts' MessageTool)
+      </action>
+
+    </release>
+
+    <release version="1.6" date="2008-12-01">
 
       <action type="fix" dev="nbubna" issue="VELOCITY-649" due-to="Byron 
Foster">
           Fix NPE when null value is passed to array/vararg method.

Modified: 
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/util/introspection/MethodMap.java
URL: 
http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/src/java/org/apache/velocity/util/introspection/MethodMap.java?rev=723123&r1=723122&r2=723123&view=diff
==============================================================================
--- 
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/util/introspection/MethodMap.java
 (original)
+++ 
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/util/introspection/MethodMap.java
 Wed Dec  3 15:14:34 2008
@@ -328,6 +328,14 @@
             if (methodArgs.length == classes.length + 1 &&
                 methodArgs[methodArgs.length - 1].isArray())
             {
+                // all the args preceding the vararg must match
+                for (int i = 0; i < classes.length; i++)
+                {
+                    if (!isConvertible(methodArgs[i], classes[i], false))
+                    {
+                        return false;
+                    }
+                }
                 return true;
             }
             else

Modified: 
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/util/introspection/UberspectImpl.java
URL: 
http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/src/java/org/apache/velocity/util/introspection/UberspectImpl.java?rev=723123&r1=723122&r2=723123&view=diff
==============================================================================
--- 
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/util/introspection/UberspectImpl.java
 (original)
+++ 
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/util/introspection/UberspectImpl.java
 Wed Dec  3 15:14:34 2008
@@ -430,8 +430,12 @@
             // if no values are being passed into the vararg
             if (actual.length == index)
             {
+                // copy existing args to new array
+                Object[] newActual = new Object[actual.length + 1];
+                System.arraycopy(actual, 0, newActual, 0, actual.length);
                 // create an empty array of the expected type
-                actual = new Object[] { Array.newInstance(type, 0) };
+                newActual[index] = Array.newInstance(type, 0);
+                actual = newActual;
             }
             // if one value is being passed into the vararg
             else if (actual.length == index + 1 && actual[index] != null)

Modified: 
velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/VarargMethodsTestCase.java
URL: 
http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/VarargMethodsTestCase.java?rev=723123&r1=723122&r2=723123&view=diff
==============================================================================
--- 
velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/VarargMethodsTestCase.java
 (original)
+++ 
velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/VarargMethodsTestCase.java
 Wed Dec  3 15:14:34 2008
@@ -121,6 +121,10 @@
         assertEvalEquals("int[]", "$nasty.test649($null)");
     }
 
+    public void testVelocity651()
+    {
+        assertEvalEquals("String,List", "$nasty.test651('test',['TEST'])");
+    }
 
 
     public static class NiceTool
@@ -229,6 +233,16 @@
             return "int[]";
         }
 
+        public String test651(String s, String s2, Object[] args)
+        {
+            return "String,String,Object[]";
+        }
+
+        public String test651(String s, java.util.List l)
+        {
+            return "String,List";
+        }
+
     }
 
 }


Reply via email to