geirm       01/05/17 06:04:20

  Modified:    src/java/org/apache/velocity/runtime/parser/node
                        ASTReference.java
  Log:
  Removed the use of the nullReferenceEventHandler as it's redundant.
  
  Sent 2nd message to list - will restore if there is opposition, but I think
  there won't as we went through this before.
  
  Revision  Changes    Path
  1.30      +44 -43    
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
  
  Index: ASTReference.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ASTReference.java 2001/04/30 17:46:52     1.29
  +++ ASTReference.java 2001/05/17 13:04:16     1.30
  @@ -84,7 +84,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Geir Magnusson Jr.</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christoph Reck</a>
    * @author <a href="mailto:[EMAIL PROTECTED]>Kent Johnson</a>
  - * @version $Id: ASTReference.java,v 1.29 2001/04/30 17:46:52 geirm Exp $ 
  + * @version $Id: ASTReference.java,v 1.30 2001/05/17 13:04:16 geirm Exp $ 
   */
   public class ASTReference extends SimpleNode
   {
  @@ -258,59 +258,51 @@
   
           /*
            *  the normal processing
  +         *
  +         *  if we have an event cartridge, get a new value object
            */
   
           EventCartridge ec = context.getEventCartridge();
   
  +        if (ec != null)
  +        {
  +            value =  ec.referenceInsert( nullString, value );
  +        }
  +
  +        /*
  +         *  if value is null...
  +         */
  +
           if (value == null)
  -        { 
  -            /*
  -             *  if we have an event cartridge, get a new value object
  +        {
  +            /* 
  +             *  write prefix twice, because it's shmoo, so the \ don't escape each 
other...
                */
  -            if (ec != null)
  +            
  +            writer.write( firstTokenPrefix );
  +            writer.write( prefix );
  +            writer.write( nullString );
  +            
  +            if (referenceType != QUIET_REFERENCE 
  +                && Runtime.getBoolean( 
  +                                      
RuntimeConstants.RUNTIME_LOG_REFERENCE_LOG_INVALID, true) )
               {
  -               value = ec.nullReferenceRender( nullString );
  +                Runtime.warn(new ReferenceException("reference : template = " 
  +                                                    + 
context.getCurrentTemplateName(), this));
               }
   
  +            return true;
  +        }
  +        else
  +        {
               /*
  -             *  if still null, then render output.  If we got a value object
  -             *  then fall through to the normal rendering
  +             *  non-null processing
                */
  -            if (value == null)
  -            {
  -                /* 
  -                 *  write prefix twice, because it's shmoo, so the \ don't escape 
each other...
  -                 */
  -                
  -                writer.write( firstTokenPrefix );
  -                writer.write( prefix );
  -                writer.write( nullString );
  -                
  -                if (referenceType != QUIET_REFERENCE 
  -                    && Runtime.getBoolean( 
  -                                          
RuntimeConstants.RUNTIME_LOG_REFERENCE_LOG_INVALID, true) )
  -                {
  -                    Runtime.warn(new ReferenceException("reference : template = " 
  -                                                        + 
context.getCurrentTemplateName(), this));
  -                }
  -
  -                return true;
  -            }
  -        }                    
  -       
  -        /*
  -         *  now see if user want's to override the value for this
  -         *  insert
  -         */
  -        if (ec != null)
  -        {
  -            value =  ec.referenceInsert( nullString, value );
  -         }
  -
  -        writer.write( firstTokenPrefix );
  -        writer.write( value.toString() );
  -                            
  -        return true;
  +            writer.write( firstTokenPrefix );
  +            writer.write( value.toString() );
  +        
  +            return true;
  +        }
       }
          
       /**
  @@ -664,6 +656,15 @@
               }
   
               referenceType = NORMAL_REFERENCE;
  +
  +
  +            //   Token tt = first;
  +
  +            //           while(tt != null)
  +            //  {
  +            //      System.out.println("->" + tt.image);
  +            //      tt = tt.next;
  +            //  }
   
               return img.substring(loc);
           }            
  
  
  

Reply via email to