geirm       2004/01/09 03:45:01

  Modified:    src/java/org/apache/velocity/io VelocityWriter.java
  Log:
  Small fix - prevent an NPE if write() is passed a null.  Also minor
  doco updates
  
  Revision  Changes    Path
  1.9       +9 -6      
jakarta-velocity/src/java/org/apache/velocity/io/VelocityWriter.java
  
  Index: VelocityWriter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/io/VelocityWriter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- VelocityWriter.java       24 Aug 2003 17:31:12 -0000      1.8
  +++ VelocityWriter.java       9 Jan 2004 11:45:01 -0000       1.9
  @@ -3,7 +3,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -101,7 +101,7 @@
        * Create a buffered character-output stream that uses a default-sized
        * output buffer.
        *
  -     * @param  response  A Servlet Response
  +     * @param  writer  Writer to wrap around
        */
       public VelocityWriter(Writer writer)
       {
  @@ -136,7 +136,7 @@
        * Create a new buffered character-output stream that uses an output
        * buffer of the given size.
        *
  -     * @param  response A Servlet Response
  +     * @param  writer  Writer to wrap around
        * @param  sz    Output-buffer size, a positive integer
        *
        * @exception  IllegalArgumentException  If sz is <= 0
  @@ -354,14 +354,17 @@
        */
       public final void write(String s) throws IOException
       {
  -     write(s, 0, s.length());
  +        if (s != null)
  +        {
  +             write(s, 0, s.length());
  +        }
       }
   
       /**
        * resets this class so that it can be reused
        *
        */
  -    public final void recycle( Writer writer)
  +    public final void recycle(Writer writer)
       {
           this.writer = writer;
           flushed = false;
  
  
  

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

Reply via email to