Github user jzonthemtn commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/108#discussion_r161116290 --- Diff: minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-runtime/src/main/java/org/apache/nifi/minifi/FlowEnricher.java --- @@ -130,17 +127,13 @@ private void enrichComponent(EnrichingElementAdapter componentToEnrich, Map<Stri componentToEnrich.setBundleInformation(enrichingBundleCoordinate); componentToEnrich.setDependsUponBundleCoordinate(enrichingBundleDetails.getDependencyCoordinate()); } else { - - // mUltiple options + // multiple options final Set<String> componentToEnrichBundleVersions = componentToEnrichVersionToBundles.values().stream() .map(bundle -> bundle.getBundleDetails().getCoordinate().getVersion()).collect(Collectors.toSet()); - final String componentToEnrichId = componentToEnrich.getComponentId(); - String bundleVersion = componentToEnrichBundleVersions.stream().sorted().reduce((version, otherVersion) -> otherVersion).orElse(null); - if (bundleVersion != null) { - componentToEnrich.setBundleInformation(componentToEnrichVersionToBundles.get(bundleVersion).getBundleDetails().getCoordinate()); - } - logger.info("Enriching {} with bundle {}", new Object[]{}); - + final String bundleVersion = componentToEnrichBundleVersions.stream().sorted().reduce((version, otherVersion) -> otherVersion).orElse(null); + final BundleCoordinate enrichingCoordinate = componentToEnrichVersionToBundles.get(bundleVersion).getBundleDetails().getCoordinate(); --- End diff -- As long as its guaranteed to not be `null` I think it is ok as is. The `orElse` is what raised a flag for me.
---