VELOCITY-688 Change so that 0 syntax causes the exception if the reference is null instead of $

git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/trunk@742851 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java b/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
index 50652a2..83b54a6 100644
--- a/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
+++ b/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
@@ -424,10 +424,8 @@
         {          
             if (strictRef)
             {
-                if (referenceType != QUIET_REFERENCE)
+                if (referenceType == QUIET_REFERENCE)
                 {
-                  log.error("Prepend the reference with '$!' e.g., $!" + literal().substring(1)
-                      + " if you want Velocity to ignore the reference when it evaluates to null");
                   if (value == null)
                   {
                     throw new VelocityException("Reference " + literal() 
diff --git a/src/test/org/apache/velocity/test/IndexTestCase.java b/src/test/org/apache/velocity/test/IndexTestCase.java
index 395ed40..ef7c933 100644
--- a/src/test/org/apache/velocity/test/IndexTestCase.java
+++ b/src/test/org/apache/velocity/test/IndexTestCase.java
@@ -29,7 +29,6 @@
     public IndexTestCase(String name)
     {
         super(name);
-        //DEBUG = true;
     }
 
     public void setUp() throws Exception
@@ -92,7 +91,7 @@
         assertEvalEquals("GOT NULL", "#set($i=$NULL)$boo[$i]");
         
         assertEvalEquals("321", "$a[-1]$a[ -2]$a[-3 ]");
-        assertEvalEquals("67xx", "#set($hash={1:11, 5:67, 23:2})$hash[5]$!hash[6]#if(!$hash[1000])xx#end");
+        assertEvalEquals("67xx", "#set($hash={1:11, 5:67, 23:2})$hash[5]$hash[6]#if(!$hash[1000])xx#end");
         
         // Some cases that should be evaluated as text
         assertEvalEquals("[]", "[]");
diff --git a/src/test/org/apache/velocity/test/StrictReferenceTestCase.java b/src/test/org/apache/velocity/test/StrictReferenceTestCase.java
index 3a9a3ba..5ab31a2 100644
--- a/src/test/org/apache/velocity/test/StrictReferenceTestCase.java
+++ b/src/test/org/apache/velocity/test/StrictReferenceTestCase.java
@@ -76,7 +76,7 @@
     public void testAllowNullValues()
         throws Exception
     {
-        evaluate("$!bar");
+        evaluate("$bar");
         assertEvalEquals("true", "#if($bar == $NULL)true#end");
         assertEvalEquals("true", "#set($foobar = $NULL)#if($foobar == $NULL)true#end");
         assertEvalEquals("13", "#set($list = [1, $NULL, 3])#foreach($item in $list)#if($item != $NULL)$item#end#end");
@@ -119,7 +119,7 @@
 
         // Mainly want to make sure no exceptions are thrown here
         assertEvalEquals("propiness", "$fargo.prop");
-        assertEvalEquals("", "$!fargo.nullVal");
+        assertEvalEquals("", "$fargo.nullVal");
         assertEvalEquals("propiness", "$fargo.next.prop");
 
         assertMethodEx("$fargo.foobar");
@@ -152,8 +152,8 @@
         assertVelocityEx("#set($fargo.prop = $NULL)$fargo.prop.next");
 
         // make sure no exceptions are thrown here
-        evaluate("$!fargo.next.next");
-        evaluate("$!fargo.next.nullVal");
+        evaluate("$fargo.next.next");
+        evaluate("$fargo.next.nullVal");
         evaluate("#foreach($item in $fargo.nullVal)#end");
     }
 
@@ -181,14 +181,14 @@
         fargo.next = new Fargo();
         context.put("fargo", fargo);      
       
-        assertVelocityEx("#set($foo = $NULL)$foo");
-        assertEvalEquals("", "#set($foo = $NULL)$!foo");
-        assertVelocityEx("$fargo.nullVal");
-        assertEvalEquals("", "$!fargo.nullVal");
-        assertVelocityEx("$fargo.next.next");
-        assertEvalEquals("", "$!fargo.next.next");
-        assertVelocityEx("$fargo.next.nullVal");
-        assertEvalEquals("", "$!fargo.next.nullVal");
+        assertVelocityEx("#set($foo = $NULL)$!foo");
+        assertEvalEquals("", "#set($foo = $NULL)$foo");
+        assertVelocityEx("$!fargo.nullVal");
+        assertEvalEquals("", "$fargo.nullVal");
+        assertVelocityEx("$!fargo.next.next");
+        assertEvalEquals("", "$fargo.next.next");
+        assertVelocityEx("$!fargo.next.nullVal");
+        assertEvalEquals("", "$fargo.next.nullVal");
     }
     
     /**