Skip to content
Permalink
Browse files

[FIXED JENKINS-39950] 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 125845a commit 79da226ab5a3561d37410520d821f53404e5185a
@@ -65,6 +65,7 @@
<orderEntry type="library" name="Maven: org.jvnet.hudson.plugins:tasks:4.46" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.hudson.plugins:warnings:4.49" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.2" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.hudson.plugins:android-lint:2.4" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.plugins:matrix-project:1.2.1" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.main:maven-plugin:2.9" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.plugins:javadoc:1.0" level="project" />
@@ -281,7 +281,7 @@ private String getWarnings(final Job<?, ?> job, final AnalysisHandler handler) {
}

private String getJobPrefix(final Job<?, ?> job) {
return hideJobPrefix ? StringUtils.EMPTY : job.getShortUrl();
return hideJobPrefix ? StringUtils.EMPTY : job.getUrl();
}

/**
@@ -2,6 +2,7 @@

import java.util.Collection;

import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;

import hudson.Extension;
@@ -207,6 +208,11 @@ public String getTotal(final Job<?, ?> job) {
return warningsAggregator.getTotal(job);
}

private String filterUrl(final String link) {
String prefix = getDashboard().getUrl();
return link.replaceFirst(prefix, StringUtils.EMPTY);
}

/**
* Returns the number of Checkstyle warnings for the specified job.
*
@@ -215,7 +221,7 @@ public String getTotal(final Job<?, ?> job) {
* @return the number of Checkstyle warnings
*/
public String getCheckStyle(final Job<?, ?> job) {
return warningsAggregator.getCheckStyle(job);
return filterUrl(warningsAggregator.getCheckStyle(job));
}

/**
@@ -226,7 +232,7 @@ public String getCheckStyle(final Job<?, ?> job) {
* @return the number of duplicate code warnings
*/
public String getDry(final Job<?, ?> job) {
return warningsAggregator.getDry(job);
return filterUrl(warningsAggregator.getDry(job));
}

/**
@@ -237,7 +243,7 @@ public String getDry(final Job<?, ?> job) {
* @return the number of FindBugs warnings
*/
public String getFindBugs(final Job<?, ?> job) {
return warningsAggregator.getFindBugs(job);
return filterUrl(warningsAggregator.getFindBugs(job));
}

/**
@@ -248,7 +254,7 @@ public String getFindBugs(final Job<?, ?> job) {
* @return the number of PMD warnings
*/
public String getPmd(final Job<?, ?> job) {
return warningsAggregator.getPmd(job);
return filterUrl(warningsAggregator.getPmd(job));
}

/**
@@ -259,7 +265,7 @@ public String getPmd(final Job<?, ?> job) {
* @return the number of open tasks
*/
public String getTasks(final Job<?, ?> job) {
return warningsAggregator.getTasks(job);
return filterUrl(warningsAggregator.getTasks(job));
}

/**
@@ -270,7 +276,7 @@ public String getTasks(final Job<?, ?> job) {
* @return the number of compiler warnings
*/
public String getCompilerWarnings(final Job<?, ?> job) {
return warningsAggregator.getCompilerWarnings(job);
return filterUrl(warningsAggregator.getCompilerWarnings(job));
}

/**
@@ -281,7 +287,7 @@ public String getCompilerWarnings(final Job<?, ?> job) {
* @return the number of Android lint warnings
*/
public String getAndroidLint(final Job<?, ?> job) {
return warningsAggregator.getAndroidLint(job);
return filterUrl(warningsAggregator.getAndroidLint(job));
}

/**

0 comments on commit 79da226

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