Null check the 'properties' element of the json message before attempting to 'rebuild' the 'DescribableList'

This commit is contained in:
Matt Moore committed 2014-06-14 16:36:59 -07:00
1 parent aa8f5955cd
commit b00aeddf4b
1 file changed
+6 -1
+6 -1
View File
@@ -1144,7 +1144,12 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
logRotator = null;
DescribableList<JobProperty<?>, JobPropertyDescriptor> t = new DescribableList<JobProperty<?>, JobPropertyDescriptor>(NOOP,getAllProperties());
t.rebuild(req,json.optJSONObject("properties"),JobPropertyDescriptor.getPropertyDescriptors(Job.this.getClass()));
JSONObject jsonProperties = json.optJSONObject("properties");
if (jsonProperties != null) {
t.rebuild(req,jsonProperties,JobPropertyDescriptor.getPropertyDescriptors(Job.this.getClass()));
} else {
t.clear();
}
properties.clear();
for (JobProperty p : t) {
p.setOwner(this);