velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From by...@apache.org
Subject svn commit: r730988 - in /velocity/engine/branches/1.6.x/src: changes/changes.xml java/org/apache/velocity/runtime/parser/node/ASTReference.java
Date Sat, 03 Jan 2009 14:15:57 GMT
Author: byron
Date: Sat Jan  3 06:15:56 2009
New Revision: 730988

URL: http://svn.apache.org/viewvc?rev=730988&view=rev
Log:
VELOCITY-656 Improve error reporting when toString() throws an exceptionin #if() testing.
moved from trunk

Modified:
    velocity/engine/branches/1.6.x/src/changes/changes.xml
    velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java

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=730988&r1=730987&r2=730988&view=diff
==============================================================================
--- velocity/engine/branches/1.6.x/src/changes/changes.xml (original)
+++ velocity/engine/branches/1.6.x/src/changes/changes.xml Sat Jan  3 06:15:56 2009
@@ -28,6 +28,11 @@
 
     <release version="1.6.2-dev" date="In Subversion">
 
+      <action type="add" dev="byron" issue="VELOCITY-656">
+	 Better error reporting when toString() throw an exception
+	 when testing an #if conditional. For example #if($foo)
+      </action>
+      
       <action type="fix" dev="byron" issue="VELOCITY-658" due-to="Jarkko Viinamäki">
           Fix $velocityHasNext so that it works in nested foreach blocks.
       </action>

Modified: velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java?rev=730988&r1=730987&r2=730988&view=diff
==============================================================================
--- velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
(original)
+++ velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
Sat Jan  3 06:15:56 2009
@@ -469,13 +469,19 @@
                 return true;
             else
                 return false;
-        }
-        else if (value.toString() == null)
+        }        
+        else
         {
-            return false;
+            try
+            {
+                return value.toString() != null;
+            }
+            catch(Exception e)
+            {
+                throw new VelocityException("Reference evaluation threw an exception at "

+                    + Log.formatFileString(this), e);
+            }
         }
-        else
-            return true;
     }
 
     /**



Mime
View raw message