aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-08-13 11:36:56 +0200
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-08-13 11:36:56 +0200
commit6c5a78202a340093aa44df95e8ceaa5daa59760d (patch)
tree3e726f48212e0e39d94aa14d17cf4ad0a6254041
parent94238980e9c11088c481de210ffc01eae9612eff (diff)
downloadsonarqube-6c5a78202a340093aa44df95e8ceaa5daa59760d.tar.gz
sonarqube-6c5a78202a340093aa44df95e8ceaa5daa59760d.zip
SONAR-4525 Fixed regression on issue bulk change of plan
-rw-r--r--sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java b/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java
index 2ff701d364e..73f2b444627 100644
--- a/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java
+++ b/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java
@@ -40,8 +40,6 @@ public class PlanAction extends Action implements ServerComponent {
private final ActionPlanService actionPlanService;
private final IssueUpdater issueUpdater;
- private ActionPlan actionPlan;
-
public PlanAction(ActionPlanService actionPlanService, IssueUpdater issueUpdater) {
super(KEY);
this.actionPlanService = actionPlanService;
@@ -53,7 +51,7 @@ public class PlanAction extends Action implements ServerComponent {
public boolean verify(Map<String, Object> properties, List<Issue> issues, UserSession userSession) {
String actionPlanValue = planValue(properties);
if (!Strings.isNullOrEmpty(actionPlanValue)) {
- ActionPlan actionPlan = getOrSelectActionPlan(actionPlanValue, userSession);
+ ActionPlan actionPlan = selectActionPlan(actionPlanValue, userSession);
if (actionPlan == null) {
throw new IllegalArgumentException("Unknown action plan: " + actionPlanValue);
}
@@ -64,8 +62,12 @@ public class PlanAction extends Action implements ServerComponent {
@Override
public boolean execute(Map<String, Object> properties, Context context) {
- String actionPlan = planValue(properties);
- return issueUpdater.plan((DefaultIssue) context.issue(), getOrSelectActionPlan(actionPlan, UserSession.get()), context.issueChangeContext());
+ ActionPlan actionPlan = null;
+ String actionPlanValue = planValue(properties);
+ if (!Strings.isNullOrEmpty(actionPlanValue)) {
+ actionPlan = selectActionPlan(actionPlanValue, UserSession.get());
+ }
+ return issueUpdater.plan((DefaultIssue) context.issue(), actionPlan, context.issueChangeContext());
}
private String planValue(Map<String, Object> properties) {
@@ -83,10 +85,7 @@ public class PlanAction extends Action implements ServerComponent {
}
}
- private ActionPlan getOrSelectActionPlan(String planValue, UserSession userSession) {
- if(actionPlan == null) {
- actionPlan = actionPlanService.findByKey(planValue, userSession);
- }
- return actionPlan;
+ private ActionPlan selectActionPlan(String planValue, UserSession userSession) {
+ return actionPlanService.findByKey(planValue, userSession);
}
} \ No newline at end of file