Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-06-01 12:31:10 +0000
committerAlexander Kurtakov2017-06-01 12:31:10 +0000
commita1b354832899c2def942e529c98e76641970348a (patch)
tree909055fe01dba902e7256fc3a932c9e820134a18
parente4022fd1a879d9b197b07f7f983b0e6483c6134f (diff)
downloadorg.eclipse.dltk.sh-a1b354832899c2def942e529c98e76641970348a.tar.gz
org.eclipse.dltk.sh-a1b354832899c2def942e529c98e76641970348a.tar.xz
org.eclipse.dltk.sh-a1b354832899c2def942e529c98e76641970348a.zip
Ensure Reader is closed in ShellDocumentationProvider.R5_8_0
Change-Id: I663f473ff500b85b803bb2a07433361fd1a589f8 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/selection/ShellDocumentationProvider.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/selection/ShellDocumentationProvider.java b/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/selection/ShellDocumentationProvider.java
index 9f9646a..239300e 100644
--- a/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/selection/ShellDocumentationProvider.java
+++ b/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/selection/ShellDocumentationProvider.java
@@ -46,13 +46,14 @@ public class ShellDocumentationProvider implements IScriptDocumentationProvider
final StringBuilder out = new StringBuilder();
try (InputStream stream = process.start().getInputStream()) {
final char[] buffer = new char[1024];
- Reader in = new InputStreamReader(stream);
- for (;;) {
- int rsz = in.read(buffer, 0, buffer.length);
- if (rsz < 0) {
- break;
+ try (Reader in = new InputStreamReader(stream)) {
+ for (;;) {
+ int rsz = in.read(buffer, 0, buffer.length);
+ if (rsz < 0) {
+ break;
+ }
+ out.append(buffer, 0, rsz);
}
- out.append(buffer, 0, rsz);
}
} catch (IOException e) {
e.printStackTrace();

Back to the top