Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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