Author: henning
Date: Sat Sep 16 03:31:11 2006
New Revision: 446846

URL: http://svn.apache.org/viewvc?view=rev&rev=446846
Log:
A hard to see bug. At the location of the (left == null ? 0 : 1),
left never could be null, because this has been tested earlier.

Actually meant was left.toString() == null, which also should not
happen (the contract of toString() normally forbids it), but nevertheless
fix the problem. Suggested by FindBugs.

Modified:
    
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java
    
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java

Modified: 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java?view=diff&rev=446846&r1=446845&r2=446846
==============================================================================
--- 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java
 (original)
+++ 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEQNode.java
 Sat Sep 16 03:31:11 2006
@@ -130,10 +130,11 @@
              */
             if ((left.toString() == null) || (right.toString() == null))  
             {
-                log.error((left.toString() == null ? "Left" : "Right") 
+               boolean culprit =  (left.toString() == null);
+                log.error((culprit ? "Left" : "Right") 
                         + " string side "
                         + "String representation ("
-                        + jjtGetChild( (left == null? 0 : 1) ).literal()
+                        + jjtGetChild((culprit ? 0 : 1) ).literal()
                         + ") of '!=' operation has null value."
                         + " Operation not possible. "
                         + context.getCurrentTemplateName() + " [line " + 
getLine() 

Modified: 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java?view=diff&rev=446846&r1=446845&r2=446846
==============================================================================
--- 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java
 (original)
+++ 
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTNENode.java
 Sat Sep 16 03:31:11 2006
@@ -112,10 +112,11 @@
              */
             if ((left.toString() == null) || (right.toString() == null))  
             {
-                log.error((left.toString() == null ? "Left" : "Right")
+               boolean culprit =  (left.toString() == null);
+                log.error((culprit ? "Left" : "Right") 
                         + " string side "
                         + "String representation ("
-                        + jjtGetChild( (left == null? 0 : 1) ).literal()
+                        + jjtGetChild((culprit ? 0 : 1) ).literal()
                         + ") of '!=' operation has null value."
                         + " Operation not possible. "
                         + context.getCurrentTemplateName() + " [line " + 
getLine() 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to