use of com.google.gerrit.server.DynamicOptions.BeanProvider in project gerrit by GerritCodeReview.
the class PluginDefinedAttributesFactories method tryCreate.
private static void tryCreate(Collection<ChangeData> cds, BeanProvider beanProvider, String plugin, ChangePluginDefinedInfoFactory infoFactory, ImmutableListMultimap.Builder<Change.Id, PluginDefinedInfo> pluginInfosByChangeBuilder) {
try {
infoFactory.createPluginDefinedInfos(cds, beanProvider, plugin).forEach((id, pdi) -> {
if (pdi != null) {
pdi.name = plugin;
pluginInfosByChangeBuilder.put(id, pdi);
}
});
} catch (RuntimeException ex) {
/* Propagate runtime exceptions as structured API data types so that queries don't fail. */
logger.atWarning().atMostEvery(1, MINUTES).withCause(ex).log("error populating attribute on changes from plugin %s", plugin);
PluginDefinedInfo errorInfo = new PluginDefinedInfo();
errorInfo.name = plugin;
errorInfo.message = "Something went wrong in plugin: " + plugin;
cds.forEach(cd -> pluginInfosByChangeBuilder.put(cd.getId(), errorInfo));
}
}
Aggregations