You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2010/03/30 07:37:18 UTC

svn commit: r928998 - in /velocity/engine/branches/2.0_Exp/src: changes/changes.xml java/org/apache/velocity/util/introspection/MethodMap.java test/org/apache/velocity/test/issues/Velocity753TestCase.java

Author: nbubna
Date: Tue Mar 30 05:37:17 2010
New Revision: 928998

URL: http://svn.apache.org/viewvc?rev=928998&view=rev
Log:
merge from trunk VELOCITY-753

Added:
    velocity/engine/branches/2.0_Exp/src/test/org/apache/velocity/test/issues/Velocity753TestCase.java
      - copied unchanged from r928988, velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity753TestCase.java
Modified:
    velocity/engine/branches/2.0_Exp/src/changes/changes.xml
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/util/introspection/MethodMap.java

Modified: velocity/engine/branches/2.0_Exp/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/changes/changes.xml?rev=928998&r1=928997&r2=928998&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/changes/changes.xml (original)
+++ velocity/engine/branches/2.0_Exp/src/changes/changes.xml Tue Mar 30 05:37:17 2010
@@ -69,11 +69,19 @@
     </release>
 
     <release version="1.7" date="In Subversion">
+      <action type="fix" dev="nbubna" issue="VELOCITY-753">
+    When comparing parameter types during method mapping, make Object always less specific than other types.
+      </action>
+
+      <action type="fix" dev="nbubna" issue="VELOCITY-759" due-to="Rachid">
+    Avoid NPEs in case of bad #foreach config.
+      </action>
+
       <action type="add" dev="nbubna" issue="VELOCITY-755">
     Use LinkedHashMap to maintain order of VTL-created maps.
       </action>
 
-      <action type="add" dev="nbubna" issue="VELOCITY-555" due-to="Jarkko Viinamäki">
+      <action type="fix" dev="nbubna" issue="VELOCITY-555" due-to="Jarkko Viinamäki">
     Treat \ as non-special in string literals, except when specifying unicode sequences.
       </action>
 
@@ -81,11 +89,11 @@
     Allow escaping of quotes (single or double) within string literals by doubling them ("" or '').
       </action>
 
-      <action type="add" dev="nbubna" issue="VELOCITY-758" due-to="Jarkko Viinamäki">
+      <action type="fix" dev="nbubna" issue="VELOCITY-758" due-to="Jarkko Viinamäki">
     Give #parse better log/exception messages and give IncludeEventHandler a chance to handle null #parse args.
       </action>
 
-      <action type="add" dev="nbubna" issue="VELOCITY-754,VELOCITY-729" due-to="Jarkko Viinamäki">
+      <action type="fix" dev="nbubna" issue="VELOCITY-754,VELOCITY-729" due-to="Jarkko Viinamäki">
     Fix $.x parsing failures (particularly helpful for jQuery users).
       </action>
 

Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/util/introspection/MethodMap.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/util/introspection/MethodMap.java?rev=928998&r1=928997&r2=928998&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/util/introspection/MethodMap.java (original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/util/introspection/MethodMap.java Tue Mar 30 05:37:17 2010
@@ -208,6 +208,7 @@ public class MethodMap
                 
         if (equivalentMatches != null)
         {
+            System.out.println("ambiguous: "+equivalentMatches);
             throw new AmbiguousException();
         }
         return bestMatch;
@@ -259,10 +260,12 @@ public class MethodMap
                 boolean last = (i == c1.length - 1);
                 c1MoreSpecific =
                     c1MoreSpecific ||
-                    isStrictConvertible(c2[i], c1[i], last);
+                    isStrictConvertible(c2[i], c1[i], last) ||
+                    c2[i] == Object.class;//Object is always least-specific
                 c2MoreSpecific =
                     c2MoreSpecific ||
-                    isStrictConvertible(c1[i], c2[i], last);
+                    isStrictConvertible(c1[i], c2[i], last) ||
+                    c1[i] == Object.class;//Object is always least-specific
             }
         }