gresockj commented on a change in pull request #4693:
URL: https://github.com/apache/nifi/pull/4693#discussion_r724494943



##########
File path: 
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecord.java
##########
@@ -426,22 +429,21 @@ public void onTrigger(ProcessContext context, 
ProcessSession session) {
         session.transfer(input, REL_SUCCESS);
     }
 
-    private void removeBadRecordFlowFiles(List<FlowFile> bad, ProcessSession 
session) {
-        for (FlowFile badFlowFile : bad) {
+    private void removeBadRecordFlowFiles(final List<FlowFile> bad, final 
ProcessSession session) {
+        for (final FlowFile badFlowFile : bad) {
             session.remove(badFlowFile);
         }
 
         bad.clear();
     }
 
-    private FlowFile indexDocuments(BulkOperation bundle, ProcessContext 
context, ProcessSession session, FlowFile input) throws Exception {
-        IndexOperationResponse response = 
clientService.bulk(bundle.getOperationList(), getUrlQueryParameters(context, 
input));
+    private FlowFile indexDocuments(final BulkOperation bundle, final 
ProcessContext context, final ProcessSession session, final FlowFile input) 
throws Exception {
+        final IndexOperationResponse response = 
clientService.bulk(bundle.getOperationList(), getUrlQueryParameters(context, 
input));
         if (response.hasErrors()) {
             if(logErrors || getLogger().isDebugEnabled()) {
-                List<Map<String, Object>> errors = response.getItems();
-                ObjectMapper mapper = new ObjectMapper();
-                mapper.enable(SerializationFeature.INDENT_OUTPUT);
-                String output = String.format("An error was encountered while 
processing bulk operations. Server response below:%n%n%s", 
mapper.writeValueAsString(errors));
+                final List<Map<String, Object>> errors = response.getItems();
+                objectMapper.enable(SerializationFeature.INDENT_OUTPUT);

Review comment:
       What do you think about putting the `enable()` call in the constructor?




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to