Clean up error output when enums have missing arguments.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2645 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
8d1d37302c
commit
1e9fe2a334
|
|
@ -278,7 +278,12 @@ class SimpleArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
|||
catch (NoSuchFieldException e) { throw new StingException("parsing " + type.toString() + "doesn't contain the field " + val.toString()); }
|
||||
}
|
||||
// if their argument has no value (null), and there's a default, return that default for the enum value
|
||||
if (defaultEnumeration != null && value == null) return defaultEnumeration;
|
||||
if (defaultEnumeration != null && value == null)
|
||||
return defaultEnumeration;
|
||||
// if their argument has no value and there's no default, throw a missing argument value exception.
|
||||
// TODO: Clean this up so that null values never make it to this point. To fix this, we'll have to clean up the implementation of -U.
|
||||
if (value == null)
|
||||
throw new MissingArgumentValueException(Collections.singleton(createDefaultArgumentDefinition(source)));
|
||||
throw new UnknownEnumeratedValueException(value, type.getName());
|
||||
} else {
|
||||
Constructor ctor = type.getConstructor(String.class);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import java.util.Enumeration;
|
|||
* <p/>
|
||||
* <p/>
|
||||
* This class is our implementation of the command line parser, similar to Pickard's. We instead
|
||||
* support GNU style command line arguements, and use this class to setup the global parser.
|
||||
* support GNU style command line arguments, and use this class to setup the global parser.
|
||||
*/
|
||||
public abstract class CommandLineProgram {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue