aboutsummaryrefslogtreecommitdiff
path: root/src/share/classes/sun/tools/jstat/OptionFinder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/classes/sun/tools/jstat/OptionFinder.java')
-rw-r--r--src/share/classes/sun/tools/jstat/OptionFinder.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/share/classes/sun/tools/jstat/OptionFinder.java b/src/share/classes/sun/tools/jstat/OptionFinder.java
index 628bd6c99..6efa5737a 100644
--- a/src/share/classes/sun/tools/jstat/OptionFinder.java
+++ b/src/share/classes/sun/tools/jstat/OptionFinder.java
@@ -39,9 +39,9 @@ public class OptionFinder {
private static final boolean debug = false;
- URL[] optionsSources;
+ List<URL> optionsSources;
- public OptionFinder(URL[] optionsSources) {
+ public OptionFinder(List<URL> optionsSources) {
this.optionsSources = optionsSources;
}
@@ -59,24 +59,25 @@ public class OptionFinder {
return of;
}
- protected OptionFormat getOptionFormat(String option, URL[] sources) {
+ protected OptionFormat getOptionFormat(String option, List<URL> sources) {
OptionFormat of = null;
- for (int i = 0; (i < sources.length) && (of == null); i++) {
+ for (URL u : sources) {
try {
- URL u = sources[i];
Reader r = new BufferedReader(
new InputStreamReader(u.openStream()));
of = new Parser(r).parse(option);
+ if (of != null)
+ break;
} catch (IOException e) {
if (debug) {
- System.err.println("Error processing " + sources[i]
+ System.err.println("Error processing " + u
+ " : " + e.getMessage());
e.printStackTrace();
}
} catch (ParserException e) {
// Exception in parsing the options file.
- System.err.println(sources[i] + ": " + e.getMessage());
- System.err.println("Parsing of " + sources[i] + " aborted");
+ System.err.println(u + ": " + e.getMessage());
+ System.err.println("Parsing of " + u + " aborted");
}
}
return of;