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:
parent
27353af216
commit
8efcb6a3b4
|
|
@ -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) {
|
} catch (ParseException e) {
|
||||||
// we didn't get all the required arguments,
|
// we didn't get all the required arguments,
|
||||||
// print out the help
|
// print out the help
|
||||||
|
e.printStackTrace();
|
||||||
this.printHelp();
|
this.printHelp();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -299,17 +303,17 @@ public class ArgumentParser {
|
||||||
ctor = f.getType().getConstructor(String.class);
|
ctor = f.getType().getConstructor(String.class);
|
||||||
return ctor.newInstance(str);
|
return ctor.newInstance(str);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
logger.fatal("constructFromString: cannot convert field " + f.toString());
|
logger.fatal("constructFromString:NoSuchMethodException: cannot convert field " + f.toString());
|
||||||
throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage());
|
throw new RuntimeException("constructFromString:NoSuchMethodException: Failed conversion " + e.getMessage());
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
logger.fatal("constructFromString: cannot convert field " + f.toString());
|
logger.fatal("constructFromString:IllegalAccessException: cannot convert field " + f.toString());
|
||||||
throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage());
|
throw new RuntimeException("constructFromString:IllegalAccessException: Failed conversion " + e.getMessage());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
logger.fatal("constructFromString: cannot convert field " + f.toString());
|
logger.fatal("constructFromString:InvocationTargetException: cannot convert field " + f.toString());
|
||||||
throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage());
|
throw new RuntimeException("constructFromString:InvocationTargetException: Failed conversion " + e.getMessage());
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
logger.fatal("constructFromString: cannot convert field " + f.toString());
|
logger.fatal("constructFromString:InstantiationException: cannot convert field " + f.toString());
|
||||||
throw new RuntimeException("constructFromString: Failed conversion " + e.getMessage());
|
throw new RuntimeException("constructFromString:InstantiationException: Failed conversion " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue