Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[FIXED JENKINS-39947] Use getUrl rather than getShortUrl.
Browse files Browse the repository at this point in the history
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 2b20fe9
Showing 1 changed file with 5 additions and 5 deletions.
@@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2b20fe9

Please sign in to comment.