You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by by...@apache.org on 2008/12/28 11:28:37 UTC
svn commit: r729715 - in /velocity/engine/branches/1.6.x: ./
src/java/org/apache/velocity/runtime/parser/node/
src/test/org/apache/velocity/test/
Author: byron
Date: Sun Dec 28 02:28:36 2008
New Revision: 729715
URL: http://svn.apache.org/viewvc?rev=729715&view=rev
Log:
merge VELOCITY-645 fix from trunk
Added:
velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/StrictCompareTestCase.java
- copied unchanged from r728869, velocity/engine/trunk/src/test/org/apache/velocity/test/StrictCompareTestCase.java
Modified:
velocity/engine/branches/1.6.x/ (props changed)
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java
velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java
Propchange: velocity/engine/branches/1.6.x/
------------------------------------------------------------------------------
svn:mergeinfo = /velocity/engine/trunk:728869
Modified: velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java?rev=729715&r1=729714&r2=729715&view=diff
==============================================================================
--- velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java (original)
+++ velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTGENode.java Sun Dec 28 02:28:36 2008
@@ -21,6 +21,8 @@
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.log.Log;
import org.apache.velocity.runtime.parser.Parser;
import org.apache.velocity.util.TemplateNumber;
@@ -84,12 +86,18 @@
if (left == null || right == null)
{
- log.error((left == null ? "Left" : "Right")
+ String msg = (left == null ? "Left" : "Right")
+ " side ("
+ jjtGetChild( (left == null? 0 : 1) ).literal()
- + ") of '>=' operation has null value."
- + " Operation not possible. "
- + Log.formatFileString(this));
+ + ") of '>=' operation has null value at "
+ + Log.formatFileString(this);
+
+ if (rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false))
+ {
+ throw new VelocityException(msg);
+ }
+
+ log.error(msg);
return false;
}
@@ -112,10 +120,16 @@
if ( !( left instanceof Number ) || !( right instanceof Number ))
{
- log.error((!(left instanceof Number) ? "Left" : "Right")
- + " side of '>=' operation is not a Number. "
- + Log.formatFileString(this));
+ String msg = (!(left instanceof Number) ? "Left" : "Right")
+ + " side of '>=' operation is not a Number at "
+ + Log.formatFileString(this);
+
+ if (rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false))
+ {
+ throw new VelocityException(msg);
+ }
+ log.error(msg);
return false;
}
Modified: velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java?rev=729715&r1=729714&r2=729715&view=diff
==============================================================================
--- velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java (original)
+++ velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTGTNode.java Sun Dec 28 02:28:36 2008
@@ -21,6 +21,8 @@
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.log.Log;
import org.apache.velocity.runtime.parser.Parser;
import org.apache.velocity.util.TemplateNumber;
@@ -84,12 +86,18 @@
if (left == null || right == null)
{
- log.error((left == null ? "Left" : "Right")
+ String msg = (left == null ? "Left" : "Right")
+ " side ("
+ jjtGetChild( (left == null? 0 : 1) ).literal()
- + ") of '>' operation has null value."
- + " Operation not possible. "
- + Log.formatFileString(this));
+ + ") of '>' operation has null value at "
+ + Log.formatFileString(this);
+
+ if (rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false))
+ {
+ throw new VelocityException(msg);
+ }
+
+ log.error(msg);
return false;
}
@@ -111,10 +119,16 @@
if ( !( left instanceof Number ) || !( right instanceof Number ))
{
- log.error((!(left instanceof Number) ? "Left" : "Right")
- + " side of '>=' operation is not a Numbere. "
- + Log.formatFileString(this));
-
+ String msg = (!(left instanceof Number) ? "Left" : "Right")
+ + " side of '>=' operation is not a Number at "
+ + Log.formatFileString(this);
+
+ if (rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false))
+ {
+ throw new VelocityException(msg);
+ }
+
+ log.error(msg);
return false;
}
Modified: velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java?rev=729715&r1=729714&r2=729715&view=diff
==============================================================================
--- velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java (original)
+++ velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTLENode.java Sun Dec 28 02:28:36 2008
@@ -21,6 +21,8 @@
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.log.Log;
import org.apache.velocity.runtime.parser.Parser;
import org.apache.velocity.util.TemplateNumber;
@@ -84,12 +86,18 @@
if (left == null || right == null)
{
- log.error((left == null ? "Left" : "Right")
+ String msg = (left == null ? "Left" : "Right")
+ " side ("
+ jjtGetChild( (left == null? 0 : 1) ).literal()
- + ") of '<=' operation has null value."
- + " Operation not possible. "
- + Log.formatFileString(this));
+ + ") of '<=' operation has null value at "
+ + Log.formatFileString(this);
+
+ if (rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false))
+ {
+ throw new VelocityException(msg);
+ }
+
+ log.error(msg);
return false;
}
@@ -110,10 +118,16 @@
*/
if ( !( left instanceof Number ) || !( right instanceof Number ))
{
- log.error((!(left instanceof Number) ? "Left" : "Right")
- + " side of '>=' operation is not a Number. "
- + Log.formatFileString(this));
+ String msg = (!(left instanceof Number) ? "Left" : "Right")
+ + " side of '>=' operation is not a Number at "
+ + Log.formatFileString(this);
+
+ if (rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false))
+ {
+ throw new VelocityException(msg);
+ }
+ log.error(msg);
return false;
}
Modified: velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java?rev=729715&r1=729714&r2=729715&view=diff
==============================================================================
--- velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java (original)
+++ velocity/engine/branches/1.6.x/src/java/org/apache/velocity/runtime/parser/node/ASTLTNode.java Sun Dec 28 02:28:36 2008
@@ -21,6 +21,8 @@
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.log.Log;
import org.apache.velocity.runtime.parser.Parser;
import org.apache.velocity.util.TemplateNumber;
@@ -84,12 +86,18 @@
if (left == null || right == null)
{
- log.error((left == null ? "Left" : "Right")
+ String msg = (left == null ? "Left" : "Right")
+ " side ("
+ jjtGetChild( (left == null? 0 : 1) ).literal()
- + ") of '<' operation has null value."
- + " Operation not possible. "
- + Log.formatFileString(this));
+ + ") of '<' operation has null value at "
+ + Log.formatFileString(this);
+
+ if (rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false))
+ {
+ throw new VelocityException(msg);
+ }
+
+ log.error(msg);
return false;
}
@@ -111,10 +119,16 @@
if ( !( left instanceof Number ) || !( right instanceof Number ))
{
- log.error((!(left instanceof Number) ? "Left" : "Right")
- + " side of '>=' operation is not a valid Number. "
- + Log.formatFileString(this));
-
+ String msg = (!(left instanceof Number) ? "Left" : "Right")
+ + " side of '>=' operation is not a valid Number at "
+ + Log.formatFileString(this);
+
+ if (rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false))
+ {
+ throw new VelocityException(msg);
+ }
+
+ log.error(msg);
return false;
}