Skip to content

Commit

Permalink
[JENKINS-46638] - Null pointer exception saving a parameterized frees…
Browse files Browse the repository at this point in the history
…tyle job with no parameters defined (#3300)

* delete NPEs

* address comments
  • Loading branch information
ksenia-nenasheva authored and oleg-nenashev committed Feb 20, 2018
1 parent 844a13f commit 02d6908
Showing 1 changed file with 2 additions and 8 deletions.
Expand Up @@ -71,17 +71,11 @@ public class ParametersDefinitionProperty extends OptionalJobProperty<Job<?, ?>>

@DataBoundConstructor
public ParametersDefinitionProperty(@Nonnull List<ParameterDefinition> parameterDefinitions) {
if (parameterDefinitions == null) {
throw new NullPointerException("ParameterDefinitions is null when this is a not valid value");
}
this.parameterDefinitions = parameterDefinitions;
this.parameterDefinitions = parameterDefinitions != null ? parameterDefinitions : new ArrayList<>();
}

public ParametersDefinitionProperty(@Nonnull ParameterDefinition... parameterDefinitions) {
if (parameterDefinitions == null) {
throw new NullPointerException("ParameterDefinitions is null when this is a not valid value");
}
this.parameterDefinitions = Arrays.asList(parameterDefinitions) ;
this.parameterDefinitions = parameterDefinitions != null ? Arrays.asList(parameterDefinitions) : new ArrayList<>();
}

private Object readResolve() {
Expand Down

0 comments on commit 02d6908

Please sign in to comment.