Github user jzonthemtn commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi/pull/108#discussion_r161082784
  
    --- 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 --
    
    Is the null check on `bundleVersion` still necessary to prevent trying to 
get a map value by key `null`?


---

Reply via email to