Skip to content

Commit

Permalink
Merge pull request #43897 from Dr15Jones/forwardCompat_13_1
Browse files Browse the repository at this point in the history
Issue exception for ROOT file forward incompatiblity problem [13_1]
  • Loading branch information
cmsbuild authored Feb 13, 2024
2 parents d7346c3 + e61876b commit 5f9959c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
5 changes: 3 additions & 2 deletions FWCore/ParameterSet/src/Entry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,9 @@ namespace edm {
}
default: {
// We should never get here.
assert("Invalid type code" == nullptr);
//throw EntryError(std::string("invalid type code ") + type);
throw edm::Exception(edm::errors::Configuration) << "Unknown ParameterSet Entry type encoding: '" << type
<< "'.\n This could be caused by reading a file which was "
"written using a newer incompatible software release.";
break;
}
} // switch(type)
Expand Down
23 changes: 17 additions & 6 deletions IOPool/Input/src/RootFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,23 @@ namespace edm {
} else {
// Merge into the parameter set registry.
pset::Registry& psetRegistry = *pset::Registry::instance();
for (auto const& psetEntry : psetMap) {
ParameterSet pset(psetEntry.second.pset());
pset.setID(psetEntry.first);
// For thread safety, don't update global registries when a secondary source opens a file.
if (inputType != InputType::SecondarySource) {
psetRegistry.insertMapped(pset);
try {
for (auto const& psetEntry : psetMap) {
ParameterSet pset(psetEntry.second.pset());
pset.setID(psetEntry.first);
// For thread safety, don't update global registries when a secondary source opens a file.
if (inputType != InputType::SecondarySource) {
psetRegistry.insertMapped(pset);
}
}
} catch (edm::Exception const& iExcept) {
if (iExcept.categoryCode() == edm::errors::Configuration) {
edm::Exception exception(edm::errors::FormatIncompatibility);
exception << iExcept.message();
exception.addContext("Creating ParameterSets from file");
throw exception;
} else {
throw;
}
}
}
Expand Down

0 comments on commit 5f9959c

Please sign in to comment.