|
From: <qua...@us...> - 2010-12-02 15:54:52
|
Revision: 367
http://stdair.svn.sourceforge.net/stdair/?rev=367&view=rev
Author: quannaus
Date: 2010-12-02 15:54:45 +0000 (Thu, 02 Dec 2010)
Log Message:
-----------
[dev] Added the basic parser types and the constructor for the exceptions.
Modified Paths:
--------------
trunk/stdair/stdair/STDAIR_Types.hpp
trunk/stdair/stdair/basic/BasConst.cpp
trunk/stdair/stdair/basic/BasConst_General.hpp
trunk/stdair/stdair/basic/PassengerType.cpp
trunk/stdair/stdair/basic/sources.mk
trunk/stdair/stdair/bom/BomManager.hpp
trunk/stdair/stdair/command/DBManagerForAirlines.cpp
trunk/stdair/stdair/factory/FacBomManager.hpp
trunk/stdair/stdair/service/DBSessionManager.cpp
trunk/stdair/stdair/service/Logger.cpp
Added Paths:
-----------
trunk/stdair/stdair/basic/BasParserHelperTypes.hpp
trunk/stdair/stdair/basic/BasParserTypes.hpp
Modified: trunk/stdair/stdair/STDAIR_Types.hpp
===================================================================
--- trunk/stdair/stdair/STDAIR_Types.hpp 2010-11-14 16:39:38 UTC (rev 366)
+++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -26,44 +26,134 @@
}
namespace stdair {
-
// Forward declarations
class STDAIR_Service;
- // ///////// Exceptions ///////////
- class RootException : public std::exception { };
-
- class FileNotFoundException : public RootException { };
-
- class NonInitialisedLogServiceException : public RootException { };
-
- class NonInitialisedDBSessionManagerException : public RootException { };
-
- class NonInitialisedServiceException : public RootException { };
-
- class NonInitialisedContainerException : public RootException { };
-
- class NonInitialisedRelationShipException : public RootException { };
-
- class MemoryAllocationException : public RootException { };
-
- class ObjectLinkingException : public RootException { };
-
- class ParserException : public RootException { };
-
- class DocumentNotFoundException : public RootException { };
-
- class CodeConversionException : public ParserException { };
-
- class CodeDuplicationException : public ParserException { };
-
- class ObjectCreationgDuplicationException : public ParserException { };
-
- class ObjectNotFoundException : public RootException { };
-
- class SQLDatabaseException : public RootException { };
-
+ // ////////////////////////////////////////////////////////////////////
+ //
+ // Exceptions
+ //
+ // ////////////////////////////////////////////////////////////////////
+ // ////////////////////////////////////////////////////////////////////
+ class RootException : public std::exception {
+ public:
+ /** Constructors. */
+ RootException (const std::string& iWhat) : _what (iWhat) {}
+ RootException () : _what ("No more details") {}
+ /** Destructor. */
+ virtual ~RootException() throw() {}
+ /** Give the details of the exception. */
+ const char* what() const throw() { return _what.c_str(); }
+ protected:
+ /** Details for the exception. */
+ std::string _what;
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class FileNotFoundException : public RootException {
+ public:
+ /** Constructor. */
+ FileNotFoundException (const std::string& iWhat) : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class NonInitialisedLogServiceException : public RootException {
+ public:
+ /** Constructor. */
+ NonInitialisedLogServiceException (const std::string& iWhat)
+ : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class NonInitialisedDBSessionManagerException : public RootException {
+ public:
+ /** Constructor. */
+ NonInitialisedDBSessionManagerException (const std::string& iWhat)
+ : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class NonInitialisedServiceException : public RootException {
+ public:
+ /** Constructor. */
+ NonInitialisedServiceException (const std::string& iWhat)
+ : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class NonInitialisedContainerException : public RootException {
+ public:
+ /** Constructor. */
+ NonInitialisedContainerException (const std::string& iWhat)
+ : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class NonInitialisedRelationShipException : public RootException {
+ public:
+ /** Constructor. */
+ NonInitialisedRelationShipException (const std::string& iWhat)
+ : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class MemoryAllocationException : public RootException {
+ public:
+ /** Constructor. */
+ MemoryAllocationException (const std::string& iWhat)
+ : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class ObjectLinkingException : public RootException {
+ public:
+ /** Constructor. */
+ ObjectLinkingException (const std::string& iWhat) : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class ParserException : public RootException {
+ public:
+ /** Constructor. */
+ ParserException (const std::string& iWhat) : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class DocumentNotFoundException : public RootException {
+ public:
+ /** Constructor. */
+ DocumentNotFoundException (const std::string& iWhat)
+ : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class CodeConversionException : public ParserException {
+ public:
+ /** Constructor. */
+ CodeConversionException (const std::string& iWhat)
+ : ParserException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class CodeDuplicationException : public ParserException {
+ public:
+ /** Constructor. */
+ CodeDuplicationException (const std::string& iWhat)
+ : ParserException(iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class ObjectCreationgDuplicationException : public ParserException {
+ public:
+ /** Constructor. */
+ ObjectCreationgDuplicationException (const std::string& iWhat)
+ : ParserException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class ObjectNotFoundException : public RootException {
+ public:
+ /** Constructor. */
+ ObjectNotFoundException (const std::string& iWhat) : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
+ class SQLDatabaseException : public RootException {
+ public:
+ /** Constructor. */
+ SQLDatabaseException (const std::string& iWhat) : RootException (iWhat) {}
+ };
+ // ////////////////////////////////////////////////////////////////////
class SQLDatabaseConnectionImpossibleException : public SQLDatabaseException {
+ public:
+ /** Constructor. */
+ SQLDatabaseConnectionImpossibleException (const std::string& iWhat)
+ : SQLDatabaseException (iWhat) {}
};
// /////////////// Log /////////////
@@ -493,81 +583,88 @@
}
-#define CATCH_ALL_EXCEPTIONS \
- catch (const stdair::FileNotFoundException& ex) { \
- std::cerr << "FileNotFoundException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::NonInitialisedLogServiceException& ex) { \
- std::cerr << "NonInitialisedLogServiceException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::NonInitialisedDBSessionManagerException& ex) { \
- std::cerr << "NonInitialisedDBSessionManagerException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::NonInitialisedServiceException& ex) { \
- std::cerr << "NonInitialisedServiceException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::NonInitialisedContainerException& ex) { \
- std::cerr << "NonInitialisedContainerException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::NonInitialisedRelationShipException& ex) { \
- std::cerr << "NonInitialisedRelationShipException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::MemoryAllocationException& ex) { \
- std::cerr << "MemoryAllocationException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::ObjectLinkingException& ex) { \
- std::cerr << "ObjectLinkingException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::CodeConversionException& ex) { \
- std::cerr << "CodeConversionException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::CodeDuplicationException& ex) { \
- std::cerr << "CodeDuplicationException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::ObjectCreationgDuplicationException& ex) { \
- std::cerr << "ObjectCreationgDuplicationException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::ObjectNotFoundException& ex) { \
- std::cerr << "ObjectNotFoundException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::DocumentNotFoundException& ex) { \
- std::cerr << "DocumentNotFoundException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::SQLDatabaseConnectionImpossibleException& ex) { \
- std::cerr << "SQLDatabaseConnectionImpossibleException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::SQLDatabaseException& ex) { \
- std::cerr << "SQLDatabaseException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::ParserException& ex) { \
- std::cerr << "ParserException" << std::endl; \
- return -1; \
- \
- } catch (const stdair::RootException& ex) { \
- std::cerr << "RootException" << std::endl; \
- return -1; \
- \
- } catch (const std::exception& stde) { \
- std::cerr << "Standard exception: " << stde.what() << std::endl; \
- return -1; \
- \
- } catch (...) { \
- return -1; \
- } \
+#define CATCH_ALL_EXCEPTIONS \
+ catch (const stdair::FileNotFoundException& ex) { \
+ std::cerr << "FileNotFoundException" << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::NonInitialisedLogServiceException& ex) { \
+ std::cerr << "NonInitialisedLogServiceException" \
+ << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::NonInitialisedDBSessionManagerException& ex) { \
+ std::cerr << "NonInitialisedDBSessionManagerException" \
+ << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::NonInitialisedServiceException& ex) { \
+ std::cerr << "NonInitialisedServiceException" \
+ << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::NonInitialisedContainerException& ex) { \
+ std::cerr << "NonInitialisedContainerException" \
+ << ex.what() <<std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::NonInitialisedRelationShipException& ex) { \
+ std::cerr << "NonInitialisedRelationShipException" \
+ << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::MemoryAllocationException& ex) { \
+ std::cerr << "MemoryAllocationException" << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::ObjectLinkingException& ex) { \
+ std::cerr << "ObjectLinkingException" << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::CodeConversionException& ex) { \
+ std::cerr << "CodeConversionException" << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::CodeDuplicationException& ex) { \
+ std::cerr << "CodeDuplicationException" << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::ObjectCreationgDuplicationException& ex) { \
+ std::cerr << "ObjectCreationgDuplicationException" \
+ << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::ObjectNotFoundException& ex) { \
+ std::cerr << "ObjectNotFoundException" << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::DocumentNotFoundException& ex) { \
+ std::cerr << "DocumentNotFoundException" << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::SQLDatabaseConnectionImpossibleException& ex) {\
+ std::cerr << "SQLDatabaseConnectionImpossibleException" \
+ << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::SQLDatabaseException& ex) { \
+ std::cerr << "SQLDatabaseException" << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::ParserException& ex) { \
+ std::cerr << "ParserException" << ex.what() << std::endl; \
+ return -1; \
+ \
+ } catch (const stdair::RootException& ex) { \
+ std::cerr << "RootException" << ex.what() <<std::endl; \
+ return -1; \
+ \
+ } catch (const std::exception& stde) { \
+ std::cerr << "Standard exception: " << stde.what() << std::endl; \
+ return -1; \
+ \
+ } catch (...) { \
+ return -1; \
+ }
#endif // __STDAIR_STDAIR_TYPES_HPP
Modified: trunk/stdair/stdair/basic/BasConst.cpp
===================================================================
--- trunk/stdair/stdair/basic/BasConst.cpp 2010-11-14 16:39:38 UTC (rev 366)
+++ trunk/stdair/stdair/basic/BasConst.cpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -29,6 +29,9 @@
const Duration_T NULL_BOOST_TIME_DURATION =
boost::posix_time::hours(0)+ boost::posix_time::minutes (0)
+ boost::posix_time::seconds (0);
+
+ /** Default number of days in a year. */
+ const unsigned int DEFAULT_NB_OF_DAYS_IN_A_YEAR = 365;
// //////// (Flight-)Period-related BOM ///////
/** Default number of duration days. */
Modified: trunk/stdair/stdair/basic/BasConst_General.hpp
===================================================================
--- trunk/stdair/stdair/basic/BasConst_General.hpp 2010-11-14 16:39:38 UTC (rev 366)
+++ trunk/stdair/stdair/basic/BasConst_General.hpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -74,6 +74,9 @@
/** Default null classCode value (''). */
extern const ClassCode_T DEFAULT_NULL_CLASS_CODE;
+
+ /** Default number of days in a year. */
+ extern const unsigned int DEFAULT_NB_OF_DAYS_IN_A_YEAR;
}
#endif // __STDAIR_BAS_BASCONST_GENERAL_HPP
Added: trunk/stdair/stdair/basic/BasParserHelperTypes.hpp
===================================================================
--- trunk/stdair/stdair/basic/BasParserHelperTypes.hpp (rev 0)
+++ trunk/stdair/stdair/basic/BasParserHelperTypes.hpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -0,0 +1,59 @@
+#ifndef __STDAIR_BAS_BASCOMPARSERHELPERTYPES_HPP
+#define __STDAIR_BAS_BASCOMPARSERHELPERTYPES_HPP
+
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <string>
+#include <sstream>
+// STDAIR
+#include <stdair/STDAIR_Types.hpp>
+#include <stdair/service/Logger.hpp>
+
+namespace stdair {
+ // ////////////////////////////////////////////////////////////////////
+ //
+ // Parser structure helper
+ //
+ // ////////////////////////////////////////////////////////////////////
+ /** Date & time element parser. */
+ template <int MIN = 0, int MAX = 0>
+ struct date_time_element {
+ unsigned int _value;
+
+ // Constructors.
+ date_time_element () { }
+ date_time_element (const date_time_element& t)
+ : _value (t._value) { }
+ date_time_element (int i) : _value (i) { }
+ // Checker.
+ void check () const {
+ if (_value < MIN || _value > MAX) {
+ std::ostringstream oMessage;
+ oMessage << "The value: " << _value << " is out of range ("
+ << MIN << ", " << MAX << ")";
+ throw stdair::ParserException (oMessage.str());
+ }
+ }
+ };
+
+ /** Operator overload. */
+ template <int MIN, int MAX>
+ inline date_time_element<MIN, MAX> operator* (const date_time_element<MIN, MAX>& o1, const date_time_element<MIN, MAX>& o2) {
+ return date_time_element<MIN, MAX> (o1._value * o2._value);
+ }
+ template <int MIN, int MAX>
+ inline date_time_element<MIN, MAX> operator+ (const date_time_element<MIN, MAX>& o1, const date_time_element<MIN, MAX>& o2) {
+ return date_time_element<MIN, MAX> (o1._value + o2._value);
+ }
+
+ /** Type definitions for the date & time elements. */
+ typedef date_time_element<0, 23> hour_t;
+ typedef date_time_element<0, 59> minute_t;
+ typedef date_time_element<0, 59> second_t;
+ typedef date_time_element<1900, 2100> year_t;
+ typedef date_time_element<1, 12> month_t;
+ typedef date_time_element<1, 31> day_t;
+}
+#endif // __STDAIR_BAS_BASCOMPARSERHELPERTYPES_HPP
Added: trunk/stdair/stdair/basic/BasParserTypes.hpp
===================================================================
--- trunk/stdair/stdair/basic/BasParserTypes.hpp (rev 0)
+++ trunk/stdair/stdair/basic/BasParserTypes.hpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -0,0 +1,54 @@
+#ifndef __STDAIR_BAS_BASCOMPARSERTYPES_HPP
+#define __STDAIR_BAS_BASCOMPARSERTYPES_HPP
+
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
+// STL
+#include <string>
+// Boost Spirit (Parsing)
+#include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/include/support_multi_pass.hpp>
+// STDAIR
+#include <stdair/basic/BasParserHelperTypes.hpp>
+
+namespace stdair {
+
+ // ////////////////////////////////////////////////////////////////////
+ //
+ // Definition of Basic Types
+ //
+ // ////////////////////////////////////////////////////////////////////
+ // The types of iterator, scanner and rule are then derived from
+ // the parsing unit.
+ typedef std::istreambuf_iterator<char> base_iterator_t;
+ typedef boost::spirit::multi_pass<base_iterator_t> iterator_t;
+
+ // ////////////////////////////////////////////////////////////////////
+ //
+ // Parser related types
+ //
+ // ////////////////////////////////////////////////////////////////////
+ /** 1-digit-integer parser */
+ typedef boost::spirit::qi::int_parser<unsigned int, 10, 1, 1> int1_p_t;
+
+ /** 2-digit-integer parser */
+ typedef boost::spirit::qi::uint_parser<int, 10, 2, 2> uint2_p_t;
+
+ /** 4-digit-integer parser */
+ typedef boost::spirit::qi::uint_parser<int, 10, 4, 4> uint4_p_t;
+
+ /** Up-to-4-digit-integer parser */
+ typedef boost::spirit::qi::uint_parser<int, 10, 1, 4> uint1_4_p_t;
+
+ /** Date & time element parsers. */
+ typedef boost::spirit::qi::uint_parser<hour_t, 10, 2, 2> hour_p_t;
+ typedef boost::spirit::qi::uint_parser<minute_t, 10, 2, 2> minute_p_t;
+ typedef boost::spirit::qi::uint_parser<second_t, 10, 2, 2> second_p_t;
+ typedef boost::spirit::qi::uint_parser<year_t, 10, 4, 4> year_p_t;
+ typedef boost::spirit::qi::uint_parser<month_t, 10, 2, 2> month_p_t;
+ typedef boost::spirit::qi::uint_parser<day_t, 10, 2, 2> day_p_t;
+}
+#endif // __STDAIR_BAS_BASCOMPARSERTYPES_HPP
Modified: trunk/stdair/stdair/basic/PassengerType.cpp
===================================================================
--- trunk/stdair/stdair/basic/PassengerType.cpp 2010-11-14 16:39:38 UTC (rev 366)
+++ trunk/stdair/stdair/basic/PassengerType.cpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -35,9 +35,10 @@
if (_type == LAST_VALUE) {
const std::string& lLabels = describeLabels();
- STDAIR_LOG_ERROR ("The passenger type '" << iType
- << "' is not known. Known passenger types: " << lLabels);
- throw CodeConversionException();
+ std::ostringstream oMessage;
+ oMessage << "The passenger type '" << iType
+ << "' is not known. Known passenger types: " << lLabels;
+ throw CodeConversionException (oMessage.str());
}
}
Modified: trunk/stdair/stdair/basic/sources.mk
===================================================================
--- trunk/stdair/stdair/basic/sources.mk 2010-11-14 16:39:38 UTC (rev 366)
+++ trunk/stdair/stdair/basic/sources.mk 2010-12-02 15:54:45 UTC (rev 367)
@@ -1,5 +1,7 @@
stdair_bas_h_sources = \
$(top_srcdir)/stdair/basic/BasTypes.hpp \
+ $(top_srcdir)/stdair/basic/BasParserTypes.hpp \
+ $(top_srcdir)/stdair/basic/BasParserHelperTypes.hpp \
$(top_srcdir)/stdair/basic/BasConst_General.hpp \
$(top_srcdir)/stdair/basic/BasConst_Request.hpp \
$(top_srcdir)/stdair/basic/BasConst_Inventory.hpp \
Modified: trunk/stdair/stdair/bom/BomManager.hpp
===================================================================
--- trunk/stdair/stdair/bom/BomManager.hpp 2010-11-14 16:39:38 UTC (rev 366)
+++ trunk/stdair/stdair/bom/BomManager.hpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -62,9 +62,10 @@
if (itHolder == lHolderMap.end()) {
std::string lName (typeid (OBJECT2).name());
- STDAIR_LOG_ERROR ("Cannot find the holder of type " << lName
- << " within: " << iObject1.describeKey());
- throw NonInitialisedContainerException ();
+ std::ostringstream oMessage;
+ oMessage << "Cannot find the holder of type " << lName
+ << " within: " << iObject1.describeKey();
+ throw NonInitialisedContainerException (oMessage.str());
}
const BomHolder<OBJECT2>* lBomHolder_ptr =
Modified: trunk/stdair/stdair/command/DBManagerForAirlines.cpp
===================================================================
--- trunk/stdair/stdair/command/DBManagerForAirlines.cpp 2010-11-14 16:39:38 UTC (rev 366)
+++ trunk/stdair/stdair/command/DBManagerForAirlines.cpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -42,8 +42,7 @@
ioSelectStatement.execute();
} catch (std::exception const& lException) {
- STDAIR_LOG_ERROR ("Error: " << lException.what());
- throw SQLDatabaseException();
+ throw SQLDatabaseException (lException.what());
}
}
@@ -73,8 +72,7 @@
ioSelectStatement.execute();
} catch (std::exception const& lException) {
- STDAIR_LOG_ERROR ("Error: " << lException.what());
- throw SQLDatabaseException();
+ throw SQLDatabaseException (lException.what());
}
}
@@ -90,8 +88,7 @@
hasStillData = ioStatement.fetch();
} catch (std::exception const& lException) {
- STDAIR_LOG_ERROR ("Error: " << lException.what());
- throw SQLDatabaseException();
+ throw SQLDatabaseException (lException.what());
}
return hasStillData;
@@ -100,9 +97,7 @@
// //////////////////////////////////////////////////////////////////////
void DBManagerForAirlines::updateAirlineInDB (DBSession_T& ioSociSession,
const AirlineStruct& iAirline) {
-
try {
-
// Begin a transaction on the database
ioSociSession.begin();
@@ -130,8 +125,7 @@
// STDAIR_LOG_DEBUG ("[" << lAirlineCode << "] " << iAirline);
} catch (std::exception const& lException) {
- STDAIR_LOG_ERROR ("Error: " << lException.what());
- throw SQLDatabaseException();
+ throw SQLDatabaseException (lException.what());
}
}
@@ -142,7 +136,6 @@
bool oHasRetrievedAirline = false;
try {
-
// Prepare the SQL request corresponding to the select statement
DBRequestStatement_T lSelectStatement (ioSociSession);
prepareSelectOnAirlineCodeStatement (ioSociSession, lSelectStatement,
@@ -162,8 +155,7 @@
// STDAIR_LOG_DEBUG ("[" << iDocID << "] " << ioAirline);
} catch (std::exception const& lException) {
- STDAIR_LOG_ERROR ("Error: " << lException.what());
- throw SQLDatabaseException();
+ throw SQLDatabaseException (lException.what());
}
return oHasRetrievedAirline;
Modified: trunk/stdair/stdair/factory/FacBomManager.hpp
===================================================================
--- trunk/stdair/stdair/factory/FacBomManager.hpp 2010-11-14 16:39:38 UTC (rev 366)
+++ trunk/stdair/stdair/factory/FacBomManager.hpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -112,7 +112,7 @@
assert (lCurrentObject_ptr != NULL);
STDAIR_LOG_DEBUG (lCurrentObject_ptr->describeKey() << "; ");
}
- throw ObjectLinkingException ();
+ throw ObjectLinkingException ("");
}
}
@@ -142,7 +142,7 @@
assert (lCurrentObject_ptr != NULL);
STDAIR_LOG_DEBUG (lCurrentObject_ptr->describeKey() << "; ");
}
- throw ObjectLinkingException ();
+ throw ObjectLinkingException ("");
}
lBomHolder._bomList.push_back (&ioObject2);
}
Modified: trunk/stdair/stdair/service/DBSessionManager.cpp
===================================================================
--- trunk/stdair/stdair/service/DBSessionManager.cpp 2010-11-14 16:39:38 UTC (rev 366)
+++ trunk/stdair/stdair/service/DBSessionManager.cpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -59,19 +59,19 @@
_dbSession = new DBSession_T;
try {
-
// Open the connection to the database
_dbSession->open (soci::mysql, lDBSessionConnectionString);
} catch (std::exception const& lException) {
- STDAIR_LOG_ERROR ("Error while opening a connection to database: "
- << lException.what());
- STDAIR_LOG_ERROR ("Database parameters used:"
- << " db=" << iDBParams.getDBName()
- << " user=" << iDBParams.getUser()
- << " port=" << iDBParams.getPort()
- << " host=" << iDBParams.getHost());
- throw SQLDatabaseConnectionImpossibleException();
+ std::ostringstream oMessage;
+ oMessage <<"Error while opening a connection to database: "
+ << lException.what() << std::endl
+ << "Database parameters used:"
+ << " db=" << iDBParams.getDBName()
+ << " user=" << iDBParams.getUser()
+ << " port=" << iDBParams.getPort()
+ << " host=" << iDBParams.getHost();
+ throw SQLDatabaseConnectionImpossibleException (oMessage.str());
}
}
@@ -95,7 +95,7 @@
// //////////////////////////////////////////////////////////////////////
DBSessionManager& DBSessionManager::instance() {
if (_instance == NULL) {
- throw NonInitialisedDBSessionManagerException();
+ throw NonInitialisedDBSessionManagerException("");
}
assert (_instance != NULL);
return *_instance;
@@ -113,7 +113,7 @@
// //////////////////////////////////////////////////////////////////////
DBSession_T& DBSessionManager::getDBSession() const {
if (_dbSession == NULL) {
- throw NonInitialisedDBSessionManagerException();
+ throw NonInitialisedDBSessionManagerException ("");
}
assert (_dbSession != NULL);
return *_dbSession;
Modified: trunk/stdair/stdair/service/Logger.cpp
===================================================================
--- trunk/stdair/stdair/service/Logger.cpp 2010-11-14 16:39:38 UTC (rev 366)
+++ trunk/stdair/stdair/service/Logger.cpp 2010-12-02 15:54:45 UTC (rev 367)
@@ -43,7 +43,7 @@
// //////////////////////////////////////////////////////////////////////
Logger& Logger::instance() {
if (_instance == NULL) {
- throw NonInitialisedLogServiceException();
+ throw NonInitialisedLogServiceException("");
}
assert (_instance != NULL);
return *_instance;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|