Skip to content

Commit

Permalink
Ignoring class cast exception for non-tabulated result for fixing iss…
Browse files Browse the repository at this point in the history
…ue. JENKINS-28018
  • Loading branch information
menonvarun committed Jan 14, 2016
1 parent 48deacc commit a7ee485
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -18,6 +18,7 @@
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.log4j.Logger;
import org.jenkinsci.plugins.testresultsanalyzer.result.info.ResultInfo;
import org.jenkinsci.plugins.testresultsanalyzer.result.data.ResultData;
import org.jenkinsci.plugins.testresultsanalyzer.result.info.ClassInfo;
Expand All @@ -31,6 +32,7 @@ public class TestResultsAnalyzerAction extends Actionable implements Action {
@SuppressWarnings("rawtypes")
AbstractProject project;
private List<Integer> builds = new ArrayList<Integer>();
private final static Logger LOG = Logger.getLogger(TestResultsAnalyzerAction.class.getName());

ResultInfo resultInfo;

Expand Down Expand Up @@ -151,10 +153,14 @@ public void getJsonLoadData() {
builds.add(run.getNumber());
List<AbstractTestResultAction> testActions = run.getActions(hudson.tasks.test.AbstractTestResultAction.class);
for (hudson.tasks.test.AbstractTestResultAction testAction : testActions) {
TabulatedResult testResult = (TabulatedResult) testAction.getResult();
Collection<? extends TestResult> packageResults = testResult.getChildren();
for (TestResult packageResult : packageResults) { // packageresult
resultInfo.addPackage(buildNumber, (TabulatedResult) packageResult, Jenkins.getInstance().getRootUrl() + buildUrl);
try {
TabulatedResult testResult = (TabulatedResult) testAction.getResult();
Collection<? extends TestResult> packageResults = testResult.getChildren();
for (TestResult packageResult : packageResults) { // packageresult
resultInfo.addPackage(buildNumber, (TabulatedResult) packageResult, Jenkins.getInstance().getRootUrl() + buildUrl);
}
} catch (ClassCastException e) {
LOG.info("Got ClassCast exception while converting results to Tabulated Result from action: " + testAction.getClass().getName() + ". Ignoring as we only want test results for processing.");
}
}
}
Expand Down

0 comments on commit a7ee485

Please sign in to comment.