Skip to content

Commit

Permalink
Changing mandatory configuration files parsing method (#847)
Browse files Browse the repository at this point in the history
Summary
This issue mentions incorrect parsing of the mandatory conf files. if there are
files with similar names all would be parsed. this is a fix for it.
Details
An example of erroneous parsing:
VSOMEIP_MANDATORY_CONFIGURATION_FILES=service.json,common.json
then only service.json and common.json should be read and parsed.
Currently if there are the following files in the configuration folder:
main_service.json
other_service.json
service.json
All are parsed. Changing the comparison method for incoming config files fixes it.

Co-authored-by: duartefonseca <[email protected]>
  • Loading branch information
duartenfonseca and duartefonseca authored Feb 18, 2025
1 parent 25bf6ed commit 1f4364d
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions implementation/configuration/src/configuration_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3214,22 +3214,13 @@ configuration_impl::get_remote_services() const {
}

bool configuration_impl::is_mandatory(const std::string &_name) const {
std::set<std::string> its_candidates;
// remove path from file name
std::string basename = _name.substr(_name.find_last_of("\\/") + 1);
for (const auto& m : mandatory_) {
if (m.size() <= _name.size()) {
its_candidates.insert(m);
}
}

if (its_candidates.empty())
return false;

for (const auto& c : its_candidates) {
if (std::equal(c.rbegin(), c.rend(), _name.rbegin())) {
if (m == basename) {
return true;
}
}

return false;
}

Expand Down

0 comments on commit 1f4364d

Please sign in to comment.