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

    https://github.com/apache/nifi/pull/419#discussion_r62914873
  
    --- Diff: 
nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteProvenanceReportingTask.java
 ---
    @@ -192,13 +179,20 @@ public void onTrigger(final ReportingContext context) 
{
             final JsonBuilderFactory factory = 
Json.createBuilderFactory(config);
             final JsonObjectBuilder builder = factory.createObjectBuilder();
     
    +        final DateFormat df = new SimpleDateFormat(TIMESTAMP_FORMAT);
    +        df.setTimeZone(TimeZone.getTimeZone("Z"));
    +
             while (events != null && !events.isEmpty()) {
                 final long start = System.nanoTime();
     
                 // Create a JSON array of all the events in the current batch
                 final JsonArrayBuilder arrayBuilder = 
factory.createArrayBuilder();
                 for (final ProvenanceEventRecord event : events) {
    -                arrayBuilder.add(serialize(factory, builder, event, 
getComponentName(procGroupStatus, event), hostname, url, rootGroupName, 
platform));
    +                String componentName = null;
    +                if (componentMap.containsKey(event.getComponentId())) {
    --- End diff --
    
    I think we can avoid this check to see if it contains key and instead just 
call the get() method. If not present it will return null anyway and is a bit 
more efficient.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to