diff options
| author | Robert Gemmell <robbie@apache.org> | 2010-10-01 11:03:35 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2010-10-01 11:03:35 +0000 |
| commit | 1bf081291825cfda8be7b4bd0e81d73b4f8d5346 (patch) | |
| tree | 1c8fc9b284a03f52e1c9b78e8774533f056707a9 | |
| parent | 98a1ec7556b70d57a7ec1312cbb47d0f4f9763be (diff) | |
| download | qpid-python-1bf081291825cfda8be7b4bd0e81d73b4f8d5346.tar.gz | |
QPID-2857: Fix issue identified by running FindBugs across the codebase. Close reader when it is no longer required
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1003479 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | java/common/src/main/java/org/apache/qpid/util/FileUtils.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/util/FileUtils.java b/java/common/src/main/java/org/apache/qpid/util/FileUtils.java index fa26786ec4..516204fbd3 100644 --- a/java/common/src/main/java/org/apache/qpid/util/FileUtils.java +++ b/java/common/src/main/java/org/apache/qpid/util/FileUtils.java @@ -374,14 +374,21 @@ public class FileUtils List<String> results = new LinkedList<String>(); BufferedReader reader = new BufferedReader(new FileReader(file)); - while (reader.ready()) + try { - String line = reader.readLine(); - if (line.contains(search)) + while (reader.ready()) { - results.add(line); + String line = reader.readLine(); + if (line.contains(search)) + { + results.add(line); + } } } + finally + { + reader.close(); + } return results; } |
