##Misleading Message?
Misleading Message?
if (args.length != 1) { System.err.println("No arguments provided."); System.exit(1); }
So if I have 2 arguments, I get the message No arguments provided
. Umm... I provided 2 arguments!
###Suggested fix:
Suggested fix:
Change the above code to:
if (args.length == 0) {
System.err.println("No arguments provided.");
System.exit(1);
}
And you can possible warn the user about only requiring one argument if they provide too much. Something like:
if (args.length > 1) {
System.out.println("Warning! Too many arguments; only the first one will be considered.");
}
##Misleading Message?
if (args.length != 1) { System.err.println("No arguments provided."); System.exit(1); }
So if I have 2 arguments, I get the message No arguments provided
. Umm... I provided 2 arguments!
###Suggested fix:
Change the above code to:
if (args.length == 0) {
System.err.println("No arguments provided.");
System.exit(1);
}
And you can possible warn the user about only requiring one argument if they provide too much. Something like:
if (args.length > 1) {
System.out.println("Warning! Too many arguments; only the first one will be considered.");
}
Misleading Message?
if (args.length != 1) { System.err.println("No arguments provided."); System.exit(1); }
So if I have 2 arguments, I get the message No arguments provided
. Umm... I provided 2 arguments!
Suggested fix:
Change the above code to:
if (args.length == 0) {
System.err.println("No arguments provided.");
System.exit(1);
}
And you can possible warn the user about only requiring one argument if they provide too much. Something like:
if (args.length > 1) {
System.out.println("Warning! Too many arguments; only the first one will be considered.");
}
##Misleading Message?
if (args.length != 1) { System.err.println("No arguments provided."); System.exit(1); }
So if I have 2 arguments, I get the message No arguments provided
. Umm... I provided 2 arguments!
###Suggested fix:
Change the above code to:
if (args.length == 0) {
System.err.println("No arguments provided.");
System.exit(1);
}
And you can possible warn the user about only requiring one argument if they provide too much. Something like:
if (args.length > 1) {
System.out.println("Warning! Too many arguments; only the first one will be considered.");
}