diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index ed744e7d005c4b0845f5f0e5e4e9ec0fe02fc347..29902fb46448c9f4fc5d91e4e7dfccbaf2d1aed6 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -74,6 +74,7 @@ set (COMMON_LIB_SRC_FILES exception/AcceptConnectionInterrupted.cpp exception/BadAlloc.cpp exception/CommandLineNotParsed.cpp + exception/InvalidArgument.cpp log/DummyLogger.cpp log/LogContext.cpp log/Logger.cpp diff --git a/tapeserver/castor/exception/InvalidArgument.cpp b/common/exception/InvalidArgument.cpp similarity index 91% rename from tapeserver/castor/exception/InvalidArgument.cpp rename to common/exception/InvalidArgument.cpp index 54a180cc758b31e6d0e0c5f23cc1860610a79ff2..073528207ff95bc1a9e7a2d09614e7d7a569db44 100644 --- a/tapeserver/castor/exception/InvalidArgument.cpp +++ b/common/exception/InvalidArgument.cpp @@ -24,10 +24,10 @@ // Include Files #include <errno.h> -#include "castor/exception/InvalidArgument.hpp" +#include "common/exception/InvalidArgument.hpp" // ----------------------------------------------------------------------- // Constructor // ----------------------------------------------------------------------- -castor::exception::InvalidArgument::InvalidArgument(const std::string& what) : +cta::exception::InvalidArgument::InvalidArgument(const std::string& what) : cta::exception::Exception(what) {} diff --git a/tapeserver/castor/exception/InvalidArgument.hpp b/common/exception/InvalidArgument.hpp similarity index 96% rename from tapeserver/castor/exception/InvalidArgument.hpp rename to common/exception/InvalidArgument.hpp index d4fab7160c90b0c0f6e83f3ca6948787e75a317e..290a684e61c4692aba394f0c5996173a3de32a82 100644 --- a/tapeserver/castor/exception/InvalidArgument.hpp +++ b/common/exception/InvalidArgument.hpp @@ -27,7 +27,7 @@ // Include Files #include "common/exception/Exception.hpp" -namespace castor { +namespace cta { namespace exception { @@ -47,5 +47,5 @@ namespace castor { } // end of namespace exception -} // end of namespace castor +} // end of namespace cta diff --git a/tapeserver/castor/io/io.cpp b/tapeserver/castor/io/io.cpp index 142f66e225fe376ebeb862514cb50d1946de6356..1deb52ae4595610b83c05b60538feb46aea54655 100644 --- a/tapeserver/castor/io/io.cpp +++ b/tapeserver/castor/io/io.cpp @@ -22,7 +22,7 @@ * @author Castor Dev team, castor-dev@cern.ch *****************************************************************************/ -#include "castor/exception/InvalidArgument.hpp" +#include "common/exception/InvalidArgument.hpp" #include "castor/io/io.hpp" #include "castor/utils/SmartFd.hpp" #include "castor/utils/utils.hpp" @@ -110,19 +110,19 @@ int castor::io::createListenerSock( // Check range validity if(lowPort < 1) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "lowPort must be greater than 0" ": lowPort=" << lowPort; throw ex; } if(highPort < 1) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "highPort must be greater than 0" ": highPort=" << lowPort; throw ex; } if(lowPort > highPort) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "lowPort must be less than or equal to highPort" ": lowPort=" << lowPort << " highPort=" << highPort; throw ex; @@ -251,7 +251,7 @@ int castor::io::acceptConnection(const int listenSocketFd) // Throw an exception if listenSocketFd is invalid if(listenSocketFd < 0) { - exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << ": Invalid listen socket file-descriptor" ": listenSocketFd=" << listenSocketFd; @@ -297,7 +297,7 @@ int castor::io::acceptConnection(const int listenSocketFd, // Throw an exception if listenSocketFd is invalid if(listenSocketFd < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "Invalid listen socket file-descriptor" ": listenSocketFd=" << listenSocketFd; @@ -402,7 +402,7 @@ castor::io::IpAndPort castor::io::getSockIpPort( // Throw an exception if socketFd is invalid if(socketFd < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "Invalid socket file-descriptor" ": socketFd=" << socketFd; @@ -431,7 +431,7 @@ castor::io::IpAndPort castor::io::getPeerIpPort( // Throw an exception if socketFd is invalid if(socketFd < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "Invalid socket file-descriptor" ": socketFd=" << socketFd; @@ -459,7 +459,7 @@ std::string castor::io::getSockHostName(const int socketFd) { // Throw an exception if socketFd is invalid if(socketFd < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "Failed to get socket hostname" ": Invalid socket file-descriptor" ": socketFd=" << socketFd; @@ -506,7 +506,7 @@ void castor::io::getSockIpHostnamePort( // Throw an exception if socketFd is invalid if(socketFd < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "Invalid socket file-descriptor" ": socketFd=" << socketFd; @@ -550,7 +550,7 @@ void castor::io::getSockIpHostnamePort( std::string castor::io::getPeerHostName(const int socketFd) { // Throw an exception if socketFd is invalid if(socketFd < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "Invalid socket file-descriptor" ": socketFd=" << socketFd; @@ -611,7 +611,7 @@ void castor::io::writeSockDescription( // Throw an exception if socketFd is invalid if(socketFd < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "Invalid socket file-descriptor" ": socketFd=" << socketFd; @@ -653,7 +653,7 @@ void castor::io::readBytes( char *const buf) { // Throw an exception if socketFd is invalid if(socketFd < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "In io::readBytes: Invalid socket file-descriptor" ": socketFd=" << socketFd; @@ -661,7 +661,7 @@ void castor::io::readBytes( } if (timeout < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "In io::readBytes: Invalid timeout value: " << timeout; throw ex; @@ -718,7 +718,7 @@ void castor::io::writeBytes( // Throw an exception if socketFd is invalid if(socketFd < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "In io::writeBytes: Invalid socket file-descriptor" ": socketFd=" << socketFd; @@ -726,7 +726,7 @@ void castor::io::writeBytes( } if (timeout < 0) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "In io::writeBytes: Invalid timeout value: " << timeout; throw ex; diff --git a/tapeserver/castor/io/io.hpp b/tapeserver/castor/io/io.hpp index 24afcc04b64eadd1eb93d0e440d96563460c4ef7..bd8a3f9b292549e62966877d7249f4741951b4db 100644 --- a/tapeserver/castor/io/io.hpp +++ b/tapeserver/castor/io/io.hpp @@ -25,7 +25,7 @@ #pragma once #include "common/exception/AcceptConnectionInterrupted.hpp" -#include "castor/exception/InvalidArgument.hpp" +#include "common/exception/InvalidArgument.hpp" #include "castor/exception/NoPortInRange.hpp" #include "castor/exception/TimeOut.hpp" #include "castor/io/Constants.hpp" diff --git a/tapeserver/castor/log/DummyLogger.cpp b/tapeserver/castor/log/DummyLogger.cpp index 68ea6cf98c1bfaec9e84a1699f20afa93f32da76..0317682cbf3053962da0dcfc4c327f3fbc6494aa 100644 --- a/tapeserver/castor/log/DummyLogger.cpp +++ b/tapeserver/castor/log/DummyLogger.cpp @@ -27,7 +27,7 @@ // constructor //------------------------------------------------------------------------------ castor::log::DummyLogger::DummyLogger(const std::string &programName) - throw(cta::exception::Exception, castor::exception::InvalidArgument): + throw(cta::exception::Exception, cta::exception::InvalidArgument): Logger(programName) { } diff --git a/tapeserver/castor/log/DummyLogger.hpp b/tapeserver/castor/log/DummyLogger.hpp index 5fd343280bd95049be094096ed10ca67e422e05a..b8eb888ab113019b00741ea9015c1cb016fddde5 100644 --- a/tapeserver/castor/log/DummyLogger.hpp +++ b/tapeserver/castor/log/DummyLogger.hpp @@ -48,7 +48,7 @@ public: * message. */ DummyLogger(const std::string &programName) - throw(cta::exception::Exception, castor::exception::InvalidArgument); + throw(cta::exception::Exception, cta::exception::InvalidArgument); /** * Destructor. diff --git a/tapeserver/castor/log/Logger.cpp b/tapeserver/castor/log/Logger.cpp index 19b85a351c38887350b9492b039ba33a1af108e1..a5c64c668280147e94520aa37864e692f2c4cf99 100644 --- a/tapeserver/castor/log/Logger.cpp +++ b/tapeserver/castor/log/Logger.cpp @@ -27,7 +27,7 @@ // constructor //------------------------------------------------------------------------------ castor::log::Logger::Logger(const std::string &programName) - throw(cta::exception::Exception, castor::exception::InvalidArgument): + throw(cta::exception::Exception, cta::exception::InvalidArgument): m_programName(programName) { } diff --git a/tapeserver/castor/log/Logger.hpp b/tapeserver/castor/log/Logger.hpp index 3c2f71a57e8d5dd406b5f4d40084208bd8cbeed7..c68d1e299b74933b6dbf209b85684d1a12456279 100644 --- a/tapeserver/castor/log/Logger.hpp +++ b/tapeserver/castor/log/Logger.hpp @@ -25,7 +25,7 @@ #pragma once // Include Files -#include "castor/exception/InvalidArgument.hpp" +#include "common/exception/InvalidArgument.hpp" #include "castor/log/Param.hpp" #include <list> @@ -95,7 +95,7 @@ public: * message. */ Logger(const std::string &programName) - throw(cta::exception::Exception, castor::exception::InvalidArgument); + throw(cta::exception::Exception, cta::exception::InvalidArgument); /** * Destructor. diff --git a/tapeserver/castor/log/StringLogger.cpp b/tapeserver/castor/log/StringLogger.cpp index 4e3d17606d0fff2c7f792832090a19859de52efe..d6343fcd35f517700ca6b50b2611f6bff82f5442 100644 --- a/tapeserver/castor/log/StringLogger.cpp +++ b/tapeserver/castor/log/StringLogger.cpp @@ -41,7 +41,7 @@ //------------------------------------------------------------------------------ castor::log::StringLogger::StringLogger( const std::string &programName) - throw(cta::exception::Exception, castor::exception::InvalidArgument): + throw(cta::exception::Exception, cta::exception::InvalidArgument): Logger(programName), m_maxMsgLen(determineMaxMsgLen()), m_priorityToText(generatePriorityToTextMap()) { diff --git a/tapeserver/castor/log/StringLogger.hpp b/tapeserver/castor/log/StringLogger.hpp index 4085544a55c548387980b7c631849c5ee87b8434..d2c019b8db67b9cae7acca5d3fdea207755314f9 100644 --- a/tapeserver/castor/log/StringLogger.hpp +++ b/tapeserver/castor/log/StringLogger.hpp @@ -55,7 +55,7 @@ public: * message. */ StringLogger(const std::string &programName) - throw(cta::exception::Exception, castor::exception::InvalidArgument); + throw(cta::exception::Exception, cta::exception::InvalidArgument); /** * Destructor. diff --git a/tapeserver/castor/log/SyslogLogger.cpp b/tapeserver/castor/log/SyslogLogger.cpp index 4c0a665b447ec61f8b6dc6fa885e09c687d5c733..dda804c795d2e376fdbfefaa3c856d7d396729c6 100644 --- a/tapeserver/castor/log/SyslogLogger.cpp +++ b/tapeserver/castor/log/SyslogLogger.cpp @@ -42,7 +42,7 @@ //------------------------------------------------------------------------------ castor::log::SyslogLogger::SyslogLogger( const std::string &programName) - throw(cta::exception::Exception, castor::exception::InvalidArgument): + throw(cta::exception::Exception, cta::exception::InvalidArgument): Logger(programName), m_maxMsgLen(determineMaxMsgLen()), m_logFile(-1), diff --git a/tapeserver/castor/log/SyslogLogger.hpp b/tapeserver/castor/log/SyslogLogger.hpp index 73922df290917a71a5a6a232285e0f559d6fbe05..3c96f31c70ac96d9bd8f3f905d71fc163ad07ffe 100644 --- a/tapeserver/castor/log/SyslogLogger.hpp +++ b/tapeserver/castor/log/SyslogLogger.hpp @@ -54,7 +54,7 @@ public: * message. */ SyslogLogger(const std::string &programName) - throw(cta::exception::Exception, castor::exception::InvalidArgument); + throw(cta::exception::Exception, cta::exception::InvalidArgument); /** * Destructor. diff --git a/tapeserver/castor/log/TestingSyslogLogger.hpp b/tapeserver/castor/log/TestingSyslogLogger.hpp index ff8b7721426d1e6434ddfa703fb2b2d6f9071a89..a5220dde2bebf3a51eebccbe228e54be6df234bf 100644 --- a/tapeserver/castor/log/TestingSyslogLogger.hpp +++ b/tapeserver/castor/log/TestingSyslogLogger.hpp @@ -43,7 +43,7 @@ public: * message. */ TestingSyslogLogger(const std::string &programName) - throw(cta::exception::Exception, castor::exception::InvalidArgument): + throw(cta::exception::Exception, cta::exception::InvalidArgument): SyslogLogger(programName) { } diff --git a/tapeserver/castor/mediachanger/AcsLibrarySlot.hpp b/tapeserver/castor/mediachanger/AcsLibrarySlot.hpp index db406a819adfc8b66a6f0bf8d9affc96e77f2cb5..471f97f0be67283270664a8089afbc5bfbbe85ae 100644 --- a/tapeserver/castor/mediachanger/AcsLibrarySlot.hpp +++ b/tapeserver/castor/mediachanger/AcsLibrarySlot.hpp @@ -21,7 +21,7 @@ #pragma once -#include "castor/exception/InvalidArgument.hpp" +#include "common/exception/InvalidArgument.hpp" #include "castor/mediachanger/LibrarySlot.hpp" #include <stdint.h> diff --git a/tapeserver/castor/mediachanger/CmdLine.cpp b/tapeserver/castor/mediachanger/CmdLine.cpp index 2d6dabb505fda770579ed3a24b09685a4299aade..62648208e665768292488ec75b218a250fe8db5a 100644 --- a/tapeserver/castor/mediachanger/CmdLine.cpp +++ b/tapeserver/castor/mediachanger/CmdLine.cpp @@ -22,7 +22,7 @@ *****************************************************************************/ #include "castor/mediachanger/CmdLine.hpp" -#include "castor/exception/InvalidArgument.hpp" +#include "common/exception/InvalidArgument.hpp" #include "castor/exception/MissingOperand.hpp" #include <getopt.h> @@ -39,7 +39,7 @@ void castor::mediachanger::CmdLine::handleMissingParameter(const int opt) { // handleUnknownOption //------------------------------------------------------------------------------ void castor::mediachanger::CmdLine::handleUnknownOption(const int opt) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; if(0 == optopt) { ex.getMessage() << "Unknown command-line option"; } else { diff --git a/tapeserver/castor/mediachanger/DismountCmd.hpp b/tapeserver/castor/mediachanger/DismountCmd.hpp index 621653cd96571df8ae3de1792e9b9f8dc10fbd46..7ad02259381fbb4de481fc720206f36b9cdc0c91 100644 --- a/tapeserver/castor/mediachanger/DismountCmd.hpp +++ b/tapeserver/castor/mediachanger/DismountCmd.hpp @@ -23,7 +23,7 @@ #pragma once -#include "castor/exception/InvalidArgument.hpp" +#include "common/exception/InvalidArgument.hpp" #include "castor/exception/MissingOperand.hpp" #include "castor/mediachanger/CmdLineTool.hpp" #include "castor/mediachanger/DismountCmdLine.hpp" diff --git a/tapeserver/castor/mediachanger/LibrarySlotParser.cpp b/tapeserver/castor/mediachanger/LibrarySlotParser.cpp index 40b2732d7c1fd76812eda06318e44ee5c6958fd4..1c99f09d23a2eb5c233f554c6aeba0eb576b5049 100644 --- a/tapeserver/castor/mediachanger/LibrarySlotParser.cpp +++ b/tapeserver/castor/mediachanger/LibrarySlotParser.cpp @@ -118,7 +118,7 @@ castor::mediachanger::AcsLibrarySlot *castor::mediachanger::LibrarySlotParser:: std::vector<std::string> components; castor::utils::splitString(str, ',', components); if(4 != components.size()) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << errMsg << ": Invalid number of components" ": expected=4, actual=" << components.size(); throw ex; @@ -127,7 +127,7 @@ castor::mediachanger::AcsLibrarySlot *castor::mediachanger::LibrarySlotParser:: // check for acs in the beginning const std::string &acsWithACS_NUMBERStr = components[0]; if(0 != acsWithACS_NUMBERStr.find("acs")) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << errMsg << ": Invalid tape library-slot format" ": expected=acsACS_NUMBER, actual=" << acsWithACS_NUMBERStr; throw ex; @@ -141,50 +141,50 @@ castor::mediachanger::AcsLibrarySlot *castor::mediachanger::LibrarySlotParser:: // Each of the 4 components must be between 1 and than 3 characters long if(1 > acsStr.length() || 3 < acsStr.length()) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << errMsg << ": Invalid ACS_NUMBER string length" ": expected=1..3, actual=" << acsStr.length(); throw ex; } if(1 > lsmStr.length() || 3 < lsmStr.length()) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << errMsg << ": Invalid LSM_NUMBER string length" ": expected=1..3, actual=" << lsmStr.length(); throw ex; } if(1 > panStr.length() || 3 < panStr.length()) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << errMsg << ": Invalid PANEL_NUMBER string length" ": expected=1..3, actual=" << panStr.length(); throw ex; } if(1 > drvStr.length() || 3 < drvStr.length()) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << errMsg << ": Invalid TRANSPORT_NUMBER string length" ": expected=1..3, actual=" << drvStr.length(); throw ex; } if(!utils::isValidUInt(acsStr)) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << errMsg << ": ACS_NUMBER must be an unsigned integer:" " value=" << acsStr; throw ex; } if(!utils::isValidUInt(lsmStr)) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << errMsg << ": LSM_NUMBER must be an unsigned integer:" " value=" << lsmStr; throw ex; } if(!utils::isValidUInt(panStr)) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << errMsg << ": PANEL_NUMBER must be an unsigned integer:" " value=" << panStr; throw ex; } if(!utils::isValidUInt(drvStr)) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << errMsg << ": TRANSPORT_NUMBER must be an unsigned" " integer: value=" << drvStr; throw ex; diff --git a/tapeserver/castor/mediachanger/MountCmd.hpp b/tapeserver/castor/mediachanger/MountCmd.hpp index 3a84eaa903a0f7d39bff73641fc8db6fc559c3bc..5229a866ff2322774ace7c69cd6bcbb03b4d2d13 100644 --- a/tapeserver/castor/mediachanger/MountCmd.hpp +++ b/tapeserver/castor/mediachanger/MountCmd.hpp @@ -23,7 +23,7 @@ #pragma once -#include "castor/exception/InvalidArgument.hpp" +#include "common/exception/InvalidArgument.hpp" #include "castor/exception/MissingOperand.hpp" #include "castor/exception/MountFailed.hpp" #include "castor/mediachanger/CmdLineTool.hpp" diff --git a/tapeserver/castor/tape/tapeserver/daemon/TpconfigLines.cpp b/tapeserver/castor/tape/tapeserver/daemon/TpconfigLines.cpp index f3bfa915c7887429417e1bd471df8a171813494b..9f1b1b96736c2e79671d2fee9ca736f56985d7c3 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/TpconfigLines.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/TpconfigLines.cpp @@ -103,7 +103,7 @@ castor::tape::tapeserver::daemon::TpconfigLines castor::tape::tapeserver:: // Throw an exception if the number of data-columns is invalid if(columns.size() != expectedNbOfColumns) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "Failed to parse TPCONFIG file" ": Invalid number of data columns in TPCONFIG line" @@ -123,7 +123,7 @@ castor::tape::tapeserver::daemon::TpconfigLines castor::tape::tapeserver:: ); if(CA_MAXUNMLEN < configLine.unitName.length()) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "Failed to parse TPCONFIG file" ": Tape-drive unit-name is too long" @@ -136,7 +136,7 @@ castor::tape::tapeserver::daemon::TpconfigLines castor::tape::tapeserver:: } if(CA_MAXDGNLEN < configLine.logicalLibrary.length()) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << "Failed to parse TPCONFIG file" ": logical library is too long" diff --git a/tapeserver/castor/tape/tapeserver/file/File.cpp b/tapeserver/castor/tape/tapeserver/file/File.cpp index cbfd9c0129c8975c44c9cd25393b9bdd21d48188..e87175d76341942c9d479a9bde3e4dd0ba95056c 100644 --- a/tapeserver/castor/tape/tapeserver/file/File.cpp +++ b/tapeserver/castor/tape/tapeserver/file/File.cpp @@ -25,7 +25,7 @@ #include "castor/exception/Errnum.hpp" #include "castor/exception/SErrnum.hpp" #include "castor/exception/Mismatch.hpp" -#include "castor/exception/InvalidArgument.hpp" +#include "common/exception/InvalidArgument.hpp" #include <sstream> #include <iomanip> #include <unistd.h> @@ -63,7 +63,7 @@ namespace castor { m_detectedLbp(false) { if(!m_vid.compare("")) { - throw castor::exception::InvalidArgument(); + throw cta::exception::InvalidArgument(); } if(m_drive.isTapeBlank()) { @@ -136,7 +136,7 @@ namespace castor { field_converter >> std::hex >> res; break; default: - throw castor::exception::InvalidArgument("Unrecognised base in HeaderChecker::checkHeaderNumericalField"); + throw cta::exception::InvalidArgument("Unrecognised base in HeaderChecker::checkHeaderNumericalField"); } return value==res; } @@ -218,7 +218,7 @@ namespace castor { std::stringstream err; err << "Unexpected fileId in ReadFile::position with fSeq expected >=1, got: " << fileToRecall.selectedTapeFile().fSeq << ")"; - throw castor::exception::InvalidArgument(err.str()); + throw cta::exception::InvalidArgument(err.str()); } int64_t fSeq_delta = fileToRecall.selectedTapeFile().fSeq @@ -396,7 +396,7 @@ namespace castor { m_volInfo(volInfo), m_detectedLbp(false) { if(!m_vid.compare("")) { - throw castor::exception::InvalidArgument(); + throw cta::exception::InvalidArgument(); } if(m_drive.isTapeBlank()) { @@ -536,7 +536,7 @@ namespace castor { err << "Unexpected fileId in WriteFile::WriteFile (expected != 0, got: " << m_fileToMigrate.archiveFile.archiveFileID << ") or fSeq (expected >=1, got: " << m_fileToMigrate.tapeFile.fSeq << ")"; - throw castor::exception::InvalidArgument(err.str()); + throw cta::exception::InvalidArgument(err.str()); } if(m_session->isCorrupted()) { throw SessionCorrupted(); diff --git a/tapeserver/castor/tape/tapeserver/file/Structures.hpp b/tapeserver/castor/tape/tapeserver/file/Structures.hpp index 997e29ef242ec25fca14ec305f1febb0b41bd7ad..5bb185cec3cbdcb92a455668fbe0327f82155d22 100644 --- a/tapeserver/castor/tape/tapeserver/file/Structures.hpp +++ b/tapeserver/castor/tape/tapeserver/file/Structures.hpp @@ -106,10 +106,10 @@ namespace tape { try { hexValue = std::stoi(LBPMethod, 0, 16); } catch (std::invalid_argument &) { - throw exception::InvalidArgument( + throw cta::exception::InvalidArgument( std::string("In VOL1::getLBPMethod(): syntax error for numeric value: ") + LBPMethod); } catch (std::out_of_range &) { - throw exception::InvalidArgument( + throw cta::exception::InvalidArgument( std::string("In VOL1::getLBPMethod(): out of range value: ") + LBPMethod); } switch (hexValue) { @@ -118,7 +118,7 @@ namespace tape { case SCSI::logicBlockProtectionMethod::ReedSolomon: return hexValue; default: - throw exception::InvalidArgument( + throw cta::exception::InvalidArgument( std::string("In VOL1::getLBPMethod(): unexpected value: ") + LBPMethod); } } diff --git a/tapeserver/castor/utils/CMakeLists.txt b/tapeserver/castor/utils/CMakeLists.txt index 8ce6f2c03f0967e6bb10c9918bb2e78113929588..00463c5a5e4a3f07f2d161cf5705201ad36e588f 100644 --- a/tapeserver/castor/utils/CMakeLists.txt +++ b/tapeserver/castor/utils/CMakeLists.txt @@ -31,7 +31,6 @@ set (UTILS_LIB_SRC_FILES utils.cpp ../common/CastorConfiguration.cpp ../exception/NoEntry.cpp - ../exception/InvalidArgument.cpp ../exception/Errnum.cpp ../exception/NotAnOwner.cpp ../exception/InvalidConfigEntry.cpp diff --git a/tapeserver/castor/utils/UtilsTest.cpp b/tapeserver/castor/utils/UtilsTest.cpp index 4c232be7c267471f2115f8543861302d4c86f7e7..3ca182ff1a7f54909f6040080bd443735624abed 100644 --- a/tapeserver/castor/utils/UtilsTest.cpp +++ b/tapeserver/castor/utils/UtilsTest.cpp @@ -332,7 +332,7 @@ TEST_F(castor_utils, testCheckDgnSyntaxTooLong) { } ASSERT_THROW(checkDgnSyntax(dgn.str().c_str()), - castor::exception::InvalidArgument); + cta::exception::InvalidArgument); } TEST_F(castor_utils, testCheckDgnSyntaxInvalidCharacter) { @@ -344,7 +344,7 @@ TEST_F(castor_utils, testCheckDgnSyntaxInvalidCharacter) { } ASSERT_THROW(checkDgnSyntax(dgn.str().c_str()), - castor::exception::InvalidArgument); + cta::exception::InvalidArgument); } TEST_F(castor_utils, testCheckVidSyntaxGoodDay) { @@ -367,7 +367,7 @@ TEST_F(castor_utils, testCheckVidSyntaxTooLong) { } ASSERT_THROW(checkVidSyntax(vid.str().c_str()), - castor::exception::InvalidArgument); + cta::exception::InvalidArgument); } TEST_F(castor_utils, testCheckVidSyntaxInvalidCharacter) { @@ -379,7 +379,7 @@ TEST_F(castor_utils, testCheckVidSyntaxInvalidCharacter) { } ASSERT_THROW(checkVidSyntax(vid.str().c_str()), - castor::exception::InvalidArgument); + cta::exception::InvalidArgument); } TEST_F(castor_utils, testErrnoToString) { diff --git a/tapeserver/castor/utils/utils.cpp b/tapeserver/castor/utils/utils.cpp index 3a6a1a9f9f8a8cb8d1c7a2c2ca92994b94cd3959..1da2efe481693b0c67551a3e2e9ca46a44e7382a 100644 --- a/tapeserver/castor/utils/utils.cpp +++ b/tapeserver/castor/utils/utils.cpp @@ -323,7 +323,7 @@ static void checkDgnVidSyntax(const char *const idTypeName, const char *id, // Check the length of the identifier string const size_t len = strlen(id); if(len > maxLen) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << idTypeName << " exceeds maximum length: actual=" << len << " max=" << maxLen; throw ex; @@ -338,7 +338,7 @@ static void checkDgnVidSyntax(const char *const idTypeName, const char *id, (c >= 'A' && c <= 'Z') || c == '_'; if(!valid) { - castor::exception::InvalidArgument ex; + cta::exception::InvalidArgument ex; ex.getMessage() << idTypeName << " contains the invalid character '" << c << "'"; throw ex; diff --git a/tapeserver/castor/utils/utils.hpp b/tapeserver/castor/utils/utils.hpp index caba1b782503c39b61cc812bd819d8cdb31027bb..eac9c6aad5ba270a1ead03bed37e3d358b3e3a71 100644 --- a/tapeserver/castor/utils/utils.hpp +++ b/tapeserver/castor/utils/utils.hpp @@ -24,7 +24,7 @@ #pragma once -#include "castor/exception/InvalidArgument.hpp" +#include "common/exception/InvalidArgument.hpp" #include "castor/exception/InvalidConfigEntry.hpp" #include "castor/exception/InvalidConfiguration.hpp" #include "common/exception/Exception.hpp"