jkf         2005/06/29 09:29:20

  Modified:    src/main/org/apache/tools/ant/util ReaderInputStream.java
               .        WHATSNEW
  Log:
  PR: 35544
  
  Avoid getting NPE on calling close() twice.
  
  Revision  Changes    Path
  1.4       +6 -4      
ant/src/main/org/apache/tools/ant/util/ReaderInputStream.java
  
  Index: ReaderInputStream.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/util/ReaderInputStream.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ReaderInputStream.java    22 Nov 2004 09:23:37 -0000      1.3
  +++ ReaderInputStream.java    29 Jun 2005 16:29:20 -0000      1.4
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 2004 The Apache Software Foundation.
  + * Copyright 2004-2005 The Apache Software Foundation.
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -196,8 +196,10 @@
        * @exception IOException if the original StringReader fails to be closed
        */
       public synchronized void close() throws IOException {
  -        in.close();
  -        slack = null;
  -        in = null;
  +        if (in != null) {
  +            in.close();
  +            slack = null;
  +            in = null;
  +        }
       }
   }
  
  
  
  1.842     +3 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.841
  retrieving revision 1.842
  diff -u -r1.841 -r1.842
  --- WHATSNEW  28 Jun 2005 12:38:46 -0000      1.841
  +++ WHATSNEW  29 Jun 2005 16:29:20 -0000      1.842
  @@ -60,6 +60,9 @@
   Fixed bugs:
   -----------
   
  +* Calling close twice on ReaderInputStream gave a nullpointer exception.
  +  Bugzilla Report 35544.
  +
   * Memory leak from IntrospectionHelper.getHelper(Class) in embedded
     environments. Bugzilla Report 30162.
   
  
  
  

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

Reply via email to