Added a check for option length, to avoid ArrayOutOfBoundExceptions if the users specifies an option without its argument. Special treatment is reserved to "-hide", which accepts both 0 or 1 parameters.

This commit is contained in:
Andrea Aime 2006-01-28 10:10:55 +00:00
parent 7ae5c25bc8
commit 43d02af81b
2 changed files with 10 additions and 0 deletions

View File

@ -180,6 +180,11 @@ class Options implements Cloneable, OptionProvider {
/** Set the options based on a lingle option and its arguments */
void setOption(String[] opt) {
if(!opt[0].equals("-hide") && optionLength(opt[0]) > opt.length) {
System.err.println("Skipping option '" + opt[0] + "', missing argument");
return;
}
if(opt[0].equals("-qualify")) {
showQualified = true;
} else if (opt[0].equals("-!qualify")) {

View File

@ -180,6 +180,11 @@ class Options implements Cloneable, OptionProvider {
/** Set the options based on a lingle option and its arguments */
void setOption(String[] opt) {
if(!opt[0].equals("-hide") && optionLength(opt[0]) > opt.length) {
System.err.println("Skipping option '" + opt[0] + "', missing argument");
return;
}
if(opt[0].equals("-qualify")) {
showQualified = true;
} else if (opt[0].equals("-!qualify")) {