diff options
Diffstat (limited to 'tools/gnu/classpath/tools/HelpPrinter.java')
-rw-r--r-- | tools/gnu/classpath/tools/HelpPrinter.java | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/tools/gnu/classpath/tools/HelpPrinter.java b/tools/gnu/classpath/tools/HelpPrinter.java index 61a3e683b..89468918a 100644 --- a/tools/gnu/classpath/tools/HelpPrinter.java +++ b/tools/gnu/classpath/tools/HelpPrinter.java @@ -70,30 +70,47 @@ public class HelpPrinter } /** - * Prints the help message and terminates. + * Prints the contents of the resource specified by the designated path. * - * @param helpResourcePath the path to the help resource, related to the + * @param helpResourcePath the path to a help resource, related to the * HelpPrinter class. */ - public static void printHelpAndExit(String helpResourcePath) + public static void printHelp(String helpResourcePath) { InputStream in = HelpPrinter.class.getResourceAsStream(helpResourcePath); - BufferedReader r = new BufferedReader(new InputStreamReader(in)); - + BufferedReader br = new BufferedReader(new InputStreamReader(in)); try { String s; - while ((s = r.readLine()) != null) - { - System.out.println(s); - } - r.close(); + while ((s = br.readLine()) != null) + System.out.println(s); } - catch (IOException e) + catch (IOException x) { System.err.print("Resource loading is broken:"); - e.printStackTrace(); + x.printStackTrace(System.err); + } + finally + { + try + { + br.close(); + } + catch (IOException ignored) + { + } } + } + + /** + * Prints the help message and terminates. + * + * @param helpResourcePath the path to the help resource, related to the + * HelpPrinter class. + */ + public static void printHelpAndExit(String helpResourcePath) + { + printHelp(helpResourcePath); System.exit(0); } } |