fjtirado commented on code in PR #3895:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3895#discussion_r2052238612


##########
jbpm/process-serialization-protobuf/src/main/java/org/jbpm/flow/serialization/impl/ProtobufProcessInstanceWriter.java:
##########
@@ -143,11 +143,8 @@ public void 
writeProcessInstance(WorkflowProcessInstanceImpl workFlow, OutputStr
 
         HeadersPersistentConfig headersConfig = 
context.get(MARSHALLER_HEADERS_CONFIG);
         if (workFlow.getHeaders() != null && headersConfig != null && 
headersConfig.enabled()) {
-            Stream<Entry<String, List<String>>> stream = 
workFlow.getHeaders().entrySet().stream();
-            if (headersConfig.excluded() != null && 
!headersConfig.excluded().isEmpty()) {
-                stream = stream.filter(e -> 
!headersConfig.excluded().contains(e.getKey()));
-            }
-            instance.addAllHeaders(stream.map(e -> 
HeaderEntry.newBuilder().setKey(e.getKey()).addAllValue(e.getValue()).build()).collect(Collectors.toList()));
+            Stream<Entry<String, List<String>>> headersStream = 
getHeadersStream(workFlow, headersConfig);
+            instance.addAllHeaders(headersStream.map(e -> 
HeaderEntry.newBuilder().setKey(e.getKey()).addAllValue(e.getValue()).build()).collect(Collectors.toList()));

Review Comment:
   I dont think is acceptable to use a filter stream operation (which is 
expected to just return false/true) to also execute debug statement. 
   Also, there was a logic issue, the filter was only executed when 
excludedheaders are specified, so, in an scenario where there is not 
excludedheaders you wont see which headers are stored at all. 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to