// the build results.
if (entries.length > 0) {
for (Entry entry : entries) {
AbstractBuild build = entry.getBuild();
if (build != null) {
GerritTrigger trigger = GerritTrigger.getTrigger(build.getProject());
Result res = build.getResult();
String customMessage = null;
/* Gerrit comments cannot contain single-newlines, as they will be joined
* together. Double newlines are interpreted as paragraph breaks. Lines that
* begin with a space (even if the space occurs somewhere in the middle of
* a multi-line paragraph) are interpreted as code blocks.
*/
str.append("\n\n");
if (trigger.getCustomUrl() == null || trigger.getCustomUrl().isEmpty()) {
str.append(rootUrl).append(entry.getBuild().getUrl());
} else {
str.append(expandParameters(trigger.getCustomUrl(), build, listener, parameters));
}
str.append(MESSAGE_DELIMITER);
if (res == Result.SUCCESS) {
customMessage = trigger.getBuildSuccessfulMessage();
} else if (res == Result.FAILURE || res == Result.ABORTED) {
customMessage = trigger.getBuildFailureMessage();
} else if (res == Result.UNSTABLE) {
customMessage = trigger.getBuildUnstableMessage();
} else if (res == Result.NOT_BUILT) {
customMessage = trigger.getBuildNotBuiltMessage();
} else {
customMessage = trigger.getBuildFailureMessage();
}
// If the user has specified a message, use it
// otherwise use a generic indicator
if (customMessage == null || customMessage.isEmpty()) {
str.append(res.toString());
if (shouldSkip(trigger.getSkipVote(), res)) {
str.append(" (skipped)");
}
} else {
str.append(customMessage);
}