Fixed: GSA-392 @arguments with just a short name get the wrong argument bindings
-- Now blows up if an argument begins with -. Implementation isn't pretty, as it actually blows up during Queue extension creation with a somewhat obscure error message but at least its something.
This commit is contained in:
parent
4c0f198d48
commit
a3d2764d11
|
|
@ -26,6 +26,7 @@
|
||||||
package org.broadinstitute.sting.commandline;
|
package org.broadinstitute.sting.commandline;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
|
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -147,6 +148,9 @@ public class ArgumentDefinition {
|
||||||
this.exclusiveOf = exclusiveOf;
|
this.exclusiveOf = exclusiveOf;
|
||||||
this.validation = validation;
|
this.validation = validation;
|
||||||
this.validOptions = validOptions;
|
this.validOptions = validOptions;
|
||||||
|
|
||||||
|
validateName(shortName);
|
||||||
|
validateName(fullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -192,6 +196,9 @@ public class ArgumentDefinition {
|
||||||
else
|
else
|
||||||
shortName = null;
|
shortName = null;
|
||||||
|
|
||||||
|
validateName(shortName);
|
||||||
|
validateName(fullName);
|
||||||
|
|
||||||
this.ioType = ioType;
|
this.ioType = ioType;
|
||||||
this.argumentType = argumentType;
|
this.argumentType = argumentType;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
|
|
@ -277,4 +284,14 @@ public class ArgumentDefinition {
|
||||||
String validation = (String)CommandLineUtils.getValue(annotation, "validation");
|
String validation = (String)CommandLineUtils.getValue(annotation, "validation");
|
||||||
return validation.trim().length() > 0 ? validation.trim() : null;
|
return validation.trim().length() > 0 ? validation.trim() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure the argument's name is valid
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
private void validateName(final String name) {
|
||||||
|
if ( name != null && name.startsWith("-") )
|
||||||
|
throw new ReviewedStingException("Invalid argument definition: " + name + " begins with a -");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue