adamdebreceni commented on a change in pull request #920:
URL: https://github.com/apache/nifi-minifi-cpp/pull/920#discussion_r508473323
##########
File path: extensions/standard-processors/processors/TailFile.cpp
##########
@@ -497,11 +497,8 @@ bool TailFile::recoverState(const
std::shared_ptr<core::ProcessContext>& context
bool TailFile::getStateFromStateManager(std::map<std::string, TailState>
&new_tail_states) const {
std::unordered_map<std::string, std::string> state_map;
if (state_manager_->get(state_map)) {
- for (size_t i = 0U;; i++) {
- std::string name;
- try {
- name = state_map.at("file." + std::to_string(i) + ".name");
- } catch (...) {
+ for (size_t i = 0U;; ++i) {
+ if (state_map.find("file." + std::to_string(i) + ".name") ==
state_map.end()) {
break;
}
Review comment:
I am genuinely curious what was the reasoning behind this code, could we
be missing something by rewriting it to `std::map<...>::find`?
----------------------------------------------------------------
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:
[email protected]