Skip to content

Commit 199951f

Browse files
committed
BasicCCDBManager: Assume infinite validity if header info is missing
This is, for now, avoiding a problem with CCDB objects that have been created locally (in the CCDB cache) and which are missing conventional meta information. Hotfixing crashes in MC. In future, we should make sure that all local CCDB objects also carry meta data.
1 parent ff00b1b commit 199951f

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

CCDB/include/CCDB/BasicCCDBManager.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,19 @@ T* CCDBManagerInstance::getForTimeStamp(std::string const& path, long timestamp)
238238
cached.objPtr.reset(ptr);
239239
}
240240
cached.uuid = mHeaders["ETag"];
241-
try { // this conversion can throw, better to catch immediately
242-
cached.startvalidity = std::stol(mHeaders["Valid-From"]);
243-
cached.endvalidity = std::stol(mHeaders["Valid-Until"]);
241+
try {
242+
if (mHeaders.find("Valid-From") != mHeaders.end()) {
243+
cached.startvalidity = std::stol(mHeaders["Valid-From"]);
244+
} else {
245+
// if meta-information missing assume infinit validity
246+
// (should happen only for locally created objects)
247+
cached.startvalidity = 0;
248+
}
249+
if (mHeaders.find("Valid-Until") != mHeaders.end()) {
250+
cached.endvalidity = std::stol(mHeaders["Valid-Until"]);
251+
} else {
252+
cached.endvalidity = std::numeric_limits<long>::max();
253+
}
244254
} catch (std::exception const& e) {
245255
reportFatal("Failed to read validity from CCDB response (Valid-From : " + mHeaders["Valid-From"] + std::string(" Valid-Until: ") + mHeaders["Valid-Until"] + std::string(")"));
246256
}

0 commit comments

Comments
 (0)