Skip to content

Commit

Permalink
avoid repeated checks inside the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
nhduongvn committed May 6, 2020
1 parent 0ceff5b commit 9072f1d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions FWCore/Catalog/src/InputFileCatalog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,14 @@ namespace edm {
if (!fileLocators_.empty())
fileLocators_.clear();

for (auto it = tmp_dataCatalogs.begin(); it != tmp_dataCatalogs.end(); ++it) {
//require the first file locator to success so obvious mistakes in data catalogs, typos for example, can be catched early
if (it == tmp_dataCatalogs.begin()) {
//require the first file locator to success so obvious mistakes in data catalogs, typos for example, can be catched early. Note that tmp_dataCatalogs is not empty at this point. The protection is done inside the dataCatalogs() above
fileLocators_.push_back(std::make_unique<FileLocator>(tmp_dataCatalogs.front()));

for (auto it = tmp_dataCatalogs.begin() + 1; it != tmp_dataCatalogs.end(); ++it) {
try {
fileLocators_.push_back(std::make_unique<FileLocator>(*it));
} else {
try {
fileLocators_.push_back(std::make_unique<FileLocator>(*it));
} catch (cms::Exception const& e) {
continue;
}
} catch (cms::Exception const& e) {
continue;
}
}

Expand Down

0 comments on commit 9072f1d

Please sign in to comment.