We now just warn about extra parameters, and provide more information if we fail to convert a command line parameter to the specified type from a string.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@153 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-03-23 19:03:59 +00:00
parent 27353af216
commit 8efcb6a3b4
1 changed files with 12 additions and 8 deletions

View File

@ -268,9 +268,13 @@ public class ArgumentParser {
}
}
}
}catch (UnrecognizedOptionException e) {
// we don't care about unknown exceptions right now
logger.warn(e.getMessage());
} catch (ParseException e) {
// we didn't get all the required arguments,
// print out the help
e.printStackTrace();
this.printHelp();
System.exit(1);
}
@ -299,17 +303,17 @@ public class ArgumentParser {
ctor = f.getType().getConstructor(String.class);
return ctor.newInstance(str);
} catch (NoSuchMethodException e) {
logger.fatal("constructFromString: cannot convert field " + f.toString());
throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage());
logger.fatal("constructFromString:NoSuchMethodException: cannot convert field " + f.toString());
throw new RuntimeException("constructFromString:NoSuchMethodException: Failed conversion " + e.getMessage());
} catch (IllegalAccessException e) {
logger.fatal("constructFromString: cannot convert field " + f.toString());
throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage());
logger.fatal("constructFromString:IllegalAccessException: cannot convert field " + f.toString());
throw new RuntimeException("constructFromString:IllegalAccessException: Failed conversion " + e.getMessage());
} catch (InvocationTargetException e) {
logger.fatal("constructFromString: cannot convert field " + f.toString());
throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage());
logger.fatal("constructFromString:InvocationTargetException: cannot convert field " + f.toString());
throw new RuntimeException("constructFromString:InvocationTargetException: Failed conversion " + e.getMessage());
} catch (InstantiationException e) {
logger.fatal("constructFromString: cannot convert field " + f.toString());
throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage());
logger.fatal("constructFromString:InstantiationException: cannot convert field " + f.toString());
throw new RuntimeException("constructFromString:InstantiationException: Failed conversion " + e.getMessage());
}
}