Skip to content

Commit

Permalink
Wrapped 'doJobAnalyze' with a 'try' because it fails sometimes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Ehlen committed Dec 19, 2019
1 parent 3f39b1b commit bdeb04d
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package org.jenkinsci.plugins.pluginusage.analyzer;

import hudson.PluginWrapper;

import hudson.model.AbstractProject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import hudson.model.Job;
import jenkins.model.Jenkins;
Expand All @@ -15,6 +17,7 @@

public class JobCollector {

private static final Logger LOGGER = Logger.getLogger(JobCollector.class.getName());
private ArrayList<JobAnalyzer> analysers = new ArrayList<>();

public JobCollector() {
Expand All @@ -39,15 +42,17 @@ public Map<PluginWrapper, JobsPerPlugin> getJobsPerPlugin()
}

List<Job> allItems = Jenkins.get().getAllItems(Job.class);

for(Job item: allItems)
{
for(JobAnalyzer analyser: analysers)
{
analyser.doJobAnalyze(item, mapJobsPerPlugin);
try{
analyser.doJobAnalyze(item, mapJobsPerPlugin);
} catch(Exception e){
LOGGER.warning("Exception catched: " + e );
}
}
}

return mapJobsPerPlugin;
}

Expand Down

0 comments on commit bdeb04d

Please sign in to comment.