Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add null check for missing plugins in pipelines #49

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -48,29 +49,29 @@
}
}
} catch(Exception e){
LOGGER.warning("Exception caught: " + e );
LOGGER.log(Level.WARNING, "Exception caught: " + e , e);
}
}

final List<Item> items = Jenkins.get().getAllItems()
.stream()
.filter(job -> !analyzers
.stream()
.map(analyzer -> analyzer.ignoreJob(job))
.reduce(false, (a, b) -> a || b))
.collect(Collectors.toList());
for(Item item: items)
{
for(AbstractProjectAnalyzer analyzer: analyzers)
{
try{
for(PluginWrapper plugin: analyzer.getPluginsFromItem(item)){
addItem(item, plugin);
}
} catch(Exception e){
LOGGER.warning("Exception caught in job " + item.getFullName() + ": " + e );
LOGGER.log(Level.WARNING, "Exception caught in job " + item.getFullName() + ": " + e , e);
} catch (Throwable e){
LOGGER.severe("Exception caught in job " + item.getFullName() + ": " + e );
LOGGER.log(Level.SEVERE,"Exception caught in job " + item.getFullName() + ": " + e, e);

Check warning on line 74 in src/main/java/org/jenkinsci/plugins/pluginusage/analyzer/JobCollector.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 52-74 are not covered by tests
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@
if (describable != null) {
final Descriptor<?> descriptor = SymbolLookup.get()
.findDescriptor(Describable.class, describable.getSymbol());
plugins.add(getPluginFromClass(descriptor.clazz));
if (descriptor != null){

Check warning on line 101 in src/main/java/org/jenkinsci/plugins/pluginusage/analyzer/PipelineLastBuildAnalyzer.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 101 is not covered by tests
plugins.add(getPluginFromClass(descriptor.clazz));
}
}
}
}
Expand Down