Skip to content
Snippets Groups Projects
Commit 02bc73c5 authored by Michael Davis's avatar Michael Davis
Browse files

[checksum] Cleans up reporting of checksum exceptions

parent 20ca4d64
No related branches found
No related tags found
No related merge requests found
......@@ -37,8 +37,8 @@ void ChecksumBlob::insert(ChecksumType type, const std::string &value) {
}
if(value.length() > expectedLength) throw exception::ChecksumValueMismatch(
"Checksum length type=" + ChecksumTypeName.at(type) +
" expected=" + std::to_string(expectedLength) +
" actual=" + std::to_string(value.length()));
" expected=" + std::to_string(expectedLength) +
" actual=" + std::to_string(value.length()));
// Pad bytearray to expected length with trailing zeros
m_cs[type] = value + std::string(expectedLength-value.length(), 0);
}
......@@ -67,7 +67,7 @@ void ChecksumBlob::validate(ChecksumType type, const std::string &value) const {
"Checksum type " + ChecksumTypeName.at(type) + " not found");
if(cs->second != value) throw exception::ChecksumValueMismatch(
"Checksum value expected=0x" + ByteArrayToHex(value) +
"actual=0x" + ByteArrayToHex(cs->second));
" actual=0x" + ByteArrayToHex(cs->second));
}
void ChecksumBlob::validate(const ChecksumBlob &blob) const {
......@@ -81,10 +81,10 @@ void ChecksumBlob::validate(const ChecksumBlob &blob) const {
for( ; it1 != m_cs.end(); ++it1, ++it2) {
if(it1->first != it2->first) throw exception::ChecksumTypeMismatch(
"Checksum type expected=" + ChecksumTypeName.at(it1->first) +
"actual=" + ChecksumTypeName.at(it2->first));
" actual=" + ChecksumTypeName.at(it2->first));
if(it1->second != it2->second) throw exception::ChecksumValueMismatch(
"Checksum value expected=0x" + ByteArrayToHex(it1->second) +
"actual=0x" + ByteArrayToHex(it2->second));
" actual=0x" + ByteArrayToHex(it2->second));
}
}
......
......@@ -158,7 +158,6 @@ void cta::ArchiveMount::reportJobsBatchTransferred(std::queue<std::unique_ptr<ct
std::set<cta::catalogue::TapeItemWrittenPointer> tapeItemsWritten;
std::list<std::unique_ptr<cta::ArchiveJob> > validatedSuccessfulArchiveJobs;
std::unique_ptr<cta::ArchiveJob> job;
std::string trace;
try{
uint64_t files=0;
uint64_t bytes=0;
......@@ -170,9 +169,7 @@ std::string trace;
job = std::move(successfulArchiveJobs.front());
successfulArchiveJobs.pop();
if (!job.get()) continue;
trace += "ONE ";
tapeItemsWritten.emplace(job->validateAndGetTapeFileWritten().release());
trace += "TWO ";
files++;
bytes+=job->archiveFile.fileSize;
validatedSuccessfulArchiveJobs.emplace_back(std::move(job));
......@@ -223,7 +220,6 @@ trace += "TWO ";
.add("diskInstance", job->archiveFile.diskInstance)
.add("diskFileId", job->archiveFile.diskFileId)
.add("lastKnownDiskPath", job->archiveFile.diskFileInfo.path)
.add("trace",trace)
.add("reportURL", job->reportURL());
}
const std::string msg_error="In ArchiveMount::reportJobsBatchWritten(): got an exception";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment