Browse Source

PR: 35544

Avoid getting NPE on calling close() twice.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278444 13f79535-47bb-0310-9956-ffa450edef68
master
Jacobus Martinus Kruithof 20 years ago
parent
commit
0900e99760
2 changed files with 9 additions and 4 deletions
  1. +3
    -0
      WHATSNEW
  2. +6
    -4
      src/main/org/apache/tools/ant/util/ReaderInputStream.java

+ 3
- 0
WHATSNEW View File

@@ -60,6 +60,9 @@ Changes that could break older environments:
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.



+ 6
- 4
src/main/org/apache/tools/ant/util/ReaderInputStream.java View File

@@ -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 @@ public class ReaderInputStream extends InputStream {
* @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;
}
}
}

Loading…
Cancel
Save