class CompoundPluginDescriptorFinder implements PluginDescriptorFinder {

    @Override
    public PluginDescriptor find(Path pluginPath) {
        for (PluginDescriptorFinder finder : finders) {
            if (finder.isApplicable(pluginPath)) {
                log.debug("'{}' is applicable for plugin '{}'", finder, pluginPath);
                try {
                    PluginDescriptor pluginDescriptor = finder.find(pluginPath);
                    if (pluginDescriptor != null) {
                        return pluginDescriptor;
                    }
                } catch (Exception e) {
                    if (finders.indexOf(finder) == finders.size() - 1) {
                        // it's the last finder
                        log.error(e.getMessage(), e);
                    } else {
                        // log the exception and continue with the next finder
                        log.debug(e.getMessage());
                        log.debug("Try to continue with the next finder");
                    }
                }
            } else {
                log.debug("'{}' is not applicable for plugin '{}'", finder, pluginPath);
            }
        }

        throw new PluginRuntimeException("No PluginDescriptorFinder for plugin '{}'", pluginPath);
    }

}