Skip to content

Commit

Permalink
JENKINS-17800 remove deprecated use of ChartUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarrien committed Apr 25, 2017
1 parent 1cf41b4 commit a5796a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 29 deletions.
21 changes: 7 additions & 14 deletions src/main/java/hudson/plugins/cobertura/CoberturaBuildAction.java
Expand Up @@ -9,8 +9,8 @@
import hudson.plugins.cobertura.targets.CoverageMetric;
import hudson.plugins.cobertura.targets.CoverageTarget;
import hudson.plugins.cobertura.targets.CoverageResult;
import hudson.util.ChartUtil;
import hudson.util.DescribableList;
import hudson.util.Graph;
import jenkins.model.RunAction2;
import jenkins.tasks.SimpleBuildStep;

Expand Down Expand Up @@ -265,19 +265,12 @@ public static CoberturaBuildAction load(CoverageResult result, CoverageTarget he
* @throws IOException forwarded from StaplerResponse.sendRedirect2
*/
public void doGraph(StaplerRequest req, StaplerResponse rsp) throws IOException {
if (ChartUtil.awtProblemCause != null) {
// not available. send out error message
rsp.sendRedirect2(req.getContextPath() + "/images/headless.png");
return;
}

Calendar t = owner.getTimestamp();

if (req.checkIfModified(t, rsp)) {
return; // up to date
}
JFreeChart chart = new CoverageChart(this).createChart();
ChartUtil.generateGraph(req, rsp, chart, 500, 200);
new Graph(owner.getTimestamp(), 500, 200) {
@Override
protected JFreeChart createGraph() {
return new CoverageChart(CoberturaBuildAction.this).createChart();
}
}.doPng(req, rsp);
}

public boolean getZoomCoverageChart() {
Expand Down
22 changes: 7 additions & 15 deletions src/main/java/hudson/plugins/cobertura/targets/CoverageResult.java
Expand Up @@ -8,7 +8,7 @@
import hudson.plugins.cobertura.CoberturaBuildAction;
import hudson.plugins.cobertura.CoverageChart;
import hudson.plugins.cobertura.Ratio;
import hudson.util.ChartUtil;
import hudson.util.Graph;
import hudson.util.TextFile;

import java.io.File;
Expand Down Expand Up @@ -469,20 +469,12 @@ public void doCoverageHighlightedSource(StaplerRequest req, StaplerResponse rsp)
* @throws IOException from StaplerResponse.sendRedirect2
*/
public void doGraph(StaplerRequest req, StaplerResponse rsp) throws IOException {
if (ChartUtil.awtProblemCause != null) {
// not available. send out error message
rsp.sendRedirect2(req.getContextPath() + "/images/headless.png");
return;
}

Run<?, ?> build = getOwner();
Calendar t = build.getTimestamp();

if (req.checkIfModified(t, rsp)) {
return; // up to date
}
JFreeChart chart = new CoverageChart(this).createChart();
ChartUtil.generateGraph(req, rsp, chart, 500, 200);
new Graph(owner.getTimestamp(), 500, 200) {
@Override
protected JFreeChart createGraph() {
return new CoverageChart(CoverageResult.this).createChart();
}
}.doPng(req, rsp);
}

/**
Expand Down

0 comments on commit a5796a4

Please sign in to comment.