jvanzyl     00/10/19 13:08:29

  Modified:    src/java/org/apache/velocity/runtime/parser
                        ASTReference.java
  Log:
  - fixed a formatting error when a shorthand variable reference
    evaluated to null i.e. when $foo was null.
  
  Revision  Changes    Path
  1.6       +10 -0     
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/ASTReference.java
  
  Index: ASTReference.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/ASTReference.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ASTReference.java 2000/10/17 11:27:37     1.5
  +++ ASTReference.java 2000/10/19 20:08:28     1.6
  @@ -164,11 +164,21 @@
        * Return the literal string representation
        * of a reference. Used when a reference has
        * a null value.
  +     *
  +     * For a variable reference like $foo this isn't
  +     * working. hmmm.
        */
       public String literal()
       {
           Token t = getFirstToken();
           StringBuffer sb = new StringBuffer(t.image);
  +        
  +        // Check to see if there are any children. If
  +        // there aren't then we can return with the first
  +        // token becasue it's a shorthand variable reference
  +        // like $foo.
  +        if (children == null)
  +            return sb.toString();
           
           while(t.next != null && t.next.last == false)
           {
  
  
  

Reply via email to