You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/01/20 06:55:54 UTC

[GitHub] [nifi] ChrisSamo632 commented on a change in pull request #4755: NIFI-8133 Add ability to suppress null/empty values in ElasticSearchCl…

ChrisSamo632 commented on a change in pull request #4755:
URL: https://github.com/apache/nifi/pull/4755#discussion_r560717188



##########
File path: nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientServiceImpl.java
##########
@@ -90,6 +93,15 @@ public void onEnabled(final ConfigurationContext context) throws InitializationE
         try {
             setupClient(context);
             responseCharset = Charset.forName(context.getProperty(CHARSET).getValue());
+
+            // re-create the ObjectMapper in case the SUPPRESS_NULLS property has changed - the JsonInclude settings aren't dynamic
+            mapper = new ObjectMapper();
+            if (ALWAYS_SUPPRESS.getValue().equals(context.getProperty(SUPPRESS_NULLS).getValue())) {
+                mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);

Review comment:
       I agree, for some reason the behaviour of the controller service once built is different to that in the integration tests (which is kind of disturbing in several ways).
   
   Will investigate the lack of `null` values when using the `NEVER_SUPPRESS` option. If possible, I'll also try to see whether there's a general issue with the integration tests.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org