Skip to content
Permalink
Browse files
[JENKINS-21314] Stack trace displayed (...) configure PrioritySorter
Fixed related issue where exception was thrown when trying
to save empty PriorityStrategy list and "Use additional
rules when assigning a priority to a Job" was enabled.
  • Loading branch information
emsa23 committed Jan 10, 2014
1 parent f13712b commit 376478e0a8af61082539e6571bbbf38c63908956
Showing with 10 additions and 8 deletions.
  1. +10 −8 src/main/java/jenkins/advancedqueue/JobGroup.java
@@ -210,14 +210,16 @@ public static JobGroup newInstance(StaplerRequest req, JSONObject jobGroupObject
jobGroup.setUsePriorityStrategies(jobGroupObject.has("usePriorityStrategies"));
if (jobGroup.isUsePriorityStrategies()) {
JSONObject jsonObject = jobGroupObject.getJSONObject("usePriorityStrategies");
JSONArray jsonArray = JSONArray.fromObject(jsonObject.get("holder"));
int psid = 0;
for (Object object : jsonArray) {
PriorityStrategyHolder holder = new JobGroup.PriorityStrategyHolder();
holder.setId(psid++);
PriorityStrategy strategy = req.bindJSON(Class.class, PriorityStrategy.class, object);
holder.setPriorityStrategy(strategy);
jobGroup.priorityStrategies.add(holder);
if (jsonObject.has("holder")) {
JSONArray jsonArray = JSONArray.fromObject(jsonObject.get("holder"));
int psid = 0;
for (Object object : jsonArray) {
PriorityStrategyHolder holder = new JobGroup.PriorityStrategyHolder();
holder.setId(psid++);
PriorityStrategy strategy = req.bindJSON(Class.class, PriorityStrategy.class, object);
holder.setPriorityStrategy(strategy);
jobGroup.priorityStrategies.add(holder);
}
}
if (jobGroup.priorityStrategies.isEmpty()) {
jobGroup.setUsePriorityStrategies(false);

0 comments on commit 376478e

Please sign in to comment.