Skip to content

Commit

Permalink
Merge pull request #9647 from wmtan/ImproveErrorMessage
Browse files Browse the repository at this point in the history
Add informative exception for hash collision
  • Loading branch information
cmsbuild committed Jun 17, 2015
2 parents 700f91a + 2dff79f commit 0f7c5e2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion FWCore/Framework/src/Principal.cc
Expand Up @@ -400,7 +400,17 @@ namespace edm {
ProductHolderBase*
Principal::getExistingProduct(ProductHolderBase const& productHolder) {
ProductHolderBase* phb = getExistingProduct(productHolder.branchDescription().branchID());
assert(nullptr == phb || BranchKey(productHolder.branchDescription()) == BranchKey(phb->branchDescription()));
if(nullptr != phb && BranchKey(productHolder.branchDescription()) != BranchKey(phb->branchDescription())) {
BranchDescription const& newProduct = phb->branchDescription();
BranchDescription const& existing = productHolder.branchDescription();
if(newProduct.branchName() != existing.branchName() && newProduct.branchID() == existing.branchID()) {
throw cms::Exception("HashCollision") << "Principal::getExistingProduct\n" <<
" Branch " << newProduct.branchName() << " has same branch ID as branch " << existing.branchName() << "\n" <<
"Workaround: change process name or product instance name of " << newProduct.branchName() << "\n";
} else {
assert(nullptr == phb || BranchKey(productHolder.branchDescription()) == BranchKey(phb->branchDescription()));
}
}
return phb;
}

Expand Down

0 comments on commit 0f7c5e2

Please sign in to comment.