Skip to content
Permalink
Browse files

[FIXED JENKINS-39947] Use getUrl rather than getShortUrl.

getShortUrl does not work with jobs in folders, we rather need to use
getUrl. Since getUrl also has the container url as prefix, this part
needs to be stripped of.
  • Loading branch information...
uhafner committed May 26, 2017
1 parent b2ce216 commit 2b20fe9e8ba17acff2a76ef5b5c3914d51dcf9b8
@@ -1,19 +1,17 @@
package hudson.plugins.analysis.dashboard;

import javax.annotation.CheckForNull;
import java.util.Collection;
import java.util.List;

import javax.annotation.CheckForNull;

import org.apache.commons.lang.StringUtils;

import com.google.common.collect.Lists;

import hudson.model.Job;

import hudson.plugins.analysis.core.ResultAction;
import hudson.plugins.analysis.core.AbstractProjectAction;
import hudson.plugins.analysis.core.BuildResult;
import hudson.plugins.analysis.core.ResultAction;

/**
* A portlet that shows a table with the number of warnings in the selected jobs.
@@ -192,7 +190,9 @@ public String getWarnings(final Job<?, ?> job) {
int numberOfAnnotations = result.getNumberOfAnnotations();
String value;
if (numberOfAnnotations > 0) {
value = String.format("<a href=\"%s%s\">%d</a>", job.getShortUrl(), action.getUrlName(), numberOfAnnotations);
String prefix = getDashboard().getUrl();
String jobUrl = job.getUrl().replaceFirst(prefix, StringUtils.EMPTY);
value = String.format("<a href=\"%s%s\">%d</a>", jobUrl, action.getUrlName(), numberOfAnnotations);
}
else {
value = String.valueOf(numberOfAnnotations);

0 comments on commit 2b20fe9

Please sign in to comment.
You can’t perform that action at this time.