Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Waibel2015-06-16 08:03:07 -0400
committerFlorian Waibel2015-06-16 08:03:07 -0400
commitceee9d5a50d65fa469b6784c7b94b27c23503d0f (patch)
treed57269a8c6b22ad69aa765500cb0e2e664b35ed7 /org.eclipse.virgo.shell.command
parent3faf4f42c9b6a568cf7ace2ce5b2565c8f0473fb (diff)
downloadorg.eclipse.virgo.kernel-ceee9d5a50d65fa469b6784c7b94b27c23503d0f.tar.gz
org.eclipse.virgo.kernel-ceee9d5a50d65fa469b6784c7b94b27c23503d0f.tar.xz
org.eclipse.virgo.kernel-ceee9d5a50d65fa469b6784c7b94b27c23503d0f.zip
Partially reverts change to try-with-resources - input stream is processed outside of the method.
Diffstat (limited to 'org.eclipse.virgo.shell.command')
-rw-r--r--org.eclipse.virgo.shell.command/src/main/java/org/eclipse/virgo/shell/internal/help/SimpleFileHelpAccessor.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.virgo.shell.command/src/main/java/org/eclipse/virgo/shell/internal/help/SimpleFileHelpAccessor.java b/org.eclipse.virgo.shell.command/src/main/java/org/eclipse/virgo/shell/internal/help/SimpleFileHelpAccessor.java
index 729e714b..48f91177 100644
--- a/org.eclipse.virgo.shell.command/src/main/java/org/eclipse/virgo/shell/internal/help/SimpleFileHelpAccessor.java
+++ b/org.eclipse.virgo.shell.command/src/main/java/org/eclipse/virgo/shell/internal/help/SimpleFileHelpAccessor.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.eclipse.virgo.util.io.IOUtils;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
import org.slf4j.Logger;
@@ -120,10 +121,13 @@ public class SimpleFileHelpAccessor implements HelpAccessor {
String fileResourceName = new StringBuffer(className).append(HELP_ACCESSOR_RESOURCE_EXTENSION).toString();
URL resourceUrl = this.helpResourceUrl(clazz, fileResourceName);
if (resourceUrl != null) {
- try (InputStream resourceIn = resourceUrl.openStream()) {
+ InputStream resourceIn = null;
+ try {
+ resourceIn = resourceUrl.openStream();
readFileIn = new BufferedReader(new InputStreamReader(resourceIn, UTF_8));
} catch (IOException ioe) {
logger.error(String.format("Exception reading help resource '%s'.", resourceUrl), ioe);
+ IOUtils.closeQuietly(resourceIn);
return null;
}
}

Back to the top