提交 95fa53c4 编写于 作者: K Kohsuke Kawaguchi

Adjusted the error handling responsibility.

So that parameter definitions can define optional parameters.
上级 8c51d269
......@@ -96,7 +96,7 @@ public class FileParameterDefinition extends ParameterDefinition {
public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException {
// capture the file to the server
FilePath src = new FilePath(command.checkChannel(),value);
File local = File.createTempFile("hudson","parameter");
File local = File.createTempFile("jenkins","parameter");
src.copyTo(new FilePath(local));
FileParameterValue p = new FileParameterValue(getName(), local, src.getName());
......
......@@ -165,6 +165,9 @@ public abstract class ParameterDefinition implements
* <p>
* If a {@link ParameterDefinition} can't really support this mode of creating a value,
* you may just always return null.
*
* @throws IllegalStateException
* If the parameter is deemed required but was missing in the submission.
*/
public abstract ParameterValue createValue(StaplerRequest req);
......
......@@ -141,8 +141,6 @@ public class ParametersDefinitionProperty extends JobProperty<AbstractProject<?,
ParameterValue value = d.createValue(req);
if (value != null) {
values.add(value);
} else if ((value == null) && !(d instanceof FileParameterDefinition)) {
throw new IllegalArgumentException("Parameter " + d.getName() + " was missing.");
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册