szaszm commented on a change in pull request #1137:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1137#discussion_r690003998



##########
File path: extensions/standard-processors/processors/AttributesToJSON.cpp
##########
@@ -94,10 +95,11 @@ void AttributesToJSON::onSchedule(core::ProcessContext* 
context, core::ProcessSe
 }
 
 bool AttributesToJSON::isCoreAttributeToBeFiltered(const std::string& 
attribute) const {
-  return !include_core_attributes_ && core_attributes_.find(attribute) != 
core_attributes_.end();
+  const auto& special_attributes = 
core::SpecialFlowAttribute::getSpecialFlowAttributes();
+  return !include_core_attributes_ && ranges::find(special_attributes, 
attribute) != ranges::end(special_attributes);
 }
 
-std::unordered_set<std::string> 
AttributesToJSON::getAttributesToBeWritten(const std::map<std::string, 
std::string>& flowfile_attributes) const {
+std::unordered_set<std::string> 
AttributesToJSON::getAttributesToBeWritten(core::FlowFile::AttributeMap* 
flowfile_attributes) const {

Review comment:
       Having a pointer parameter that we're not checking for null before 
dereferencing is a recipe for disaster. Can we change it to const ref? We don't 
seem to modify the AttributeMap.




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