in src/com/vmware/vim25/mo/util/CommandLineParser.java [249:292]
public void validate(Object className, String functionName)
{
if(optsEntered.isEmpty()){
displayUsage();
throw new IllegalArgumentException("---help");
}
if(optsEntered.get("help")!=null){
displayUsage();
System.exit(1);
}
if(option_is_set("help")){
displayUsage();
System.exit(1);
}
Vector<String> vec = getValue(builtInOpts);
for(int i=0;i<vec.size();i++){
if(optsEntered.get(vec.get(i))==null){
String missingArg = vec.get(i);
if(missingArg.equalsIgnoreCase("password")) {
String password = readPassword("Enter password: ");
optsEntered.put("password", password);
}
else {
System.out.print("----ERROR: "+vec.get(i)+" not specified \n");
displayUsage();
throw new IllegalArgumentException("----ERROR: "+vec.get(i)+" not specified \n");
}
}
}
vec = getValue(userOpts);
for(int i=0;i<vec.size();i++){
if(optsEntered.get(vec.get(i))==null){
System.out.print("----ERROR: "+vec.get(i)+" not specified \n");
displayUsage();
throw new IllegalArgumentException("----ERROR: "+vec.get(i)+" not specified \n");
}
}
if((optsEntered.get("sessionfile")==null)&&
((optsEntered.get("username")==null) &&(optsEntered.get("password")==null))){
System.out.println("Must have one of command options 'sessionfile' or a 'username' and 'password' pair\n");
displayUsage();
throw new IllegalArgumentException("Must have one of command options 'sessionfile' or a 'username' and 'password' pair\n");
}
}