Browse Source

Fix quality flaws

tags/6.3-RC1
Julien Lancelot 7 years ago
parent
commit
6e813f24d7

+ 7
- 4
server/sonar-server/src/main/java/org/sonar/server/issue/workflow/IssueWorkflow.java View File

@@ -179,8 +179,9 @@ public class IssueWorkflow implements Startable {
}

public List<Transition> outTransitions(Issue issue) {
State state = machine.state(issue.status());
checkArgument(state != null, "Unknown status: %s", issue.status());
String status = issue.status();
State state = machine.state(status);
checkArgument(state != null, "Unknown status: %s", status);
return state.outManualTransitions(issue);
}

@@ -197,8 +198,10 @@ public class IssueWorkflow implements Startable {
}

private State stateOf(DefaultIssue issue) {
State state = machine.state(issue.status());
checkState(state != null, "Unknown status: %s [issue=%s]", issue.status(), issue.key());
String status = issue.status();
State state = machine.state(status);
String issueKey = issue.key();
checkState(state != null, "Unknown status: %s [issue=%s]", status, issueKey);
return state;
}


+ 3
- 1
server/sonar-server/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java View File

@@ -63,6 +63,7 @@ import org.sonarqube.ws.Issues;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.ImmutableMap.of;
import static java.lang.String.format;
import static java.util.function.Function.identity;
import static org.sonar.api.issue.DefaultTransitions.REOPEN;
import static org.sonar.api.rule.Severity.BLOCKER;
@@ -219,7 +220,8 @@ public class BulkChangeAction implements IssuesWsAction {
}
} catch (Exception e) {
result.increaseFailure();
LOG.error("An error occur when trying to apply the action : {} on issue : {}. This issue has been ignored. Error is '{}'", action.key(), issue.key(), e.getMessage());
LOG.error(format("An error occur when trying to apply the action : %s on issue : %s. This issue has been ignored. Error is '%s'",
action.key(), issue.key(), e.getMessage()), e);
}
};
}

+ 1
- 1
sonar-plugin-api/src/main/java/org/sonar/api/utils/TimeProfiler.java View File

@@ -55,7 +55,7 @@ public class TimeProfiler {
this.name = name;
this.start = System.currentTimeMillis();
if (debug) {
logger.debug(name + "...");
logger.debug("%s ...", name);
} else {
logger.info(name + "...");
}

Loading…
Cancel
Save