diff --git a/arangod/RestServer/ArangoServer.cpp b/arangod/RestServer/ArangoServer.cpp index 964627e241..78f62b0759 100644 --- a/arangod/RestServer/ArangoServer.cpp +++ b/arangod/RestServer/ArangoServer.cpp @@ -284,8 +284,8 @@ ArangoServer::ArangoServer (int argc, char** argv) _defaultMaximalSize(TRI_JOURNAL_DEFAULT_MAXIMAL_SIZE), _defaultWaitForSync(false), _disableReplicationApplier(false), - _server(nullptr), - _developmentMode(false) { + _developmentMode(false), + _server(nullptr) { char* p = TRI_GetTempPath(); // copy the string diff --git a/arangod/Utils/Exception.cpp b/arangod/Utils/Exception.cpp index 55af9c900e..921343da4d 100644 --- a/arangod/Utils/Exception.cpp +++ b/arangod/Utils/Exception.cpp @@ -73,7 +73,13 @@ Exception::~Exception () throw () { //////////////////////////////////////////////////////////////////////////////// char const* Exception::what () const throw () { - string message("exception in '"); + // we have to use an instance member here because we should not return a + // pointer (c_str()) to the internals of a stack object (stack object will + // be destroyed when function is left...) + // additionally, we should not create new string values here as this might + // throw exceptions - but this function is marked to throw no exceptions! + /* + std::string message = "exception in '"; message.append(_file); message.append("' at line "); message.append(basics::StringUtils::itoa(_line)); @@ -81,22 +87,9 @@ char const* Exception::what () const throw () { message += this->message(); return message.c_str(); -} + */ -//////////////////////////////////////////////////////////////////////////////// -/// @brief return exception message -//////////////////////////////////////////////////////////////////////////////// - -string Exception::message () const throw () { - return _errorMessage; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief return exception code -//////////////////////////////////////////////////////////////////////////////// - -int Exception::code () const throw () { - return _code; + return _errorMessage.c_str(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/Utils/Exception.h b/arangod/Utils/Exception.h index 5fa32758c3..75e67eb025 100644 --- a/arangod/Utils/Exception.h +++ b/arangod/Utils/Exception.h @@ -73,7 +73,9 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// class Exception : public virtual std::exception { + public: + Exception (int code, char const* file, int line); @@ -86,19 +88,24 @@ namespace triagens { ~Exception () throw (); public: - char const * what () const throw (); - std::string message () const throw (); + char const * what () const throw (); + + std::string message () const throw () { + return _errorMessage; + } - int code () const throw(); + int code () const throw () { + return _code; + } static std::string FillExceptionString (int, ...); protected: std::string const _errorMessage; - char const* _file; - int const _line; - int const _code; + char const* _file; + int const _line; + int const _code; }; } diff --git a/lib/Utilities/Completer.h b/lib/Utilities/Completer.h index 4d57129bc4..5e66e7beb5 100644 --- a/lib/Utilities/Completer.h +++ b/lib/Utilities/Completer.h @@ -35,35 +35,46 @@ namespace triagens { -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup Shell -/// @{ -//////////////////////////////////////////////////////////////////////////////// - class Completer { - public: -//////////////////////////////////////////////////////////////////////////////// -/// @brief public constructors destructors -//////////////////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- +// --SECTION-- constructors / destructors +// ----------------------------------------------------------------------------- - virtual ~Completer() {}; + public: + + Completer () { + } + + virtual ~Completer () { + } + +// ----------------------------------------------------------------------------- +// --SECTION-- public methods +// ----------------------------------------------------------------------------- + + public: //////////////////////////////////////////////////////////////////////////////// /// @brief check if line is complete //////////////////////////////////////////////////////////////////////////////// - virtual bool isComplete(std::string const&, size_t lineno, size_t column) = 0; + virtual bool isComplete (std::string const&, + size_t lineno, + size_t column) = 0; //////////////////////////////////////////////////////////////////////////////// /// @brief computes all strings which begins with the given text //////////////////////////////////////////////////////////////////////////////// - virtual void getAlternatives(char const *, std::vector &) = 0; + virtual void getAlternatives (char const*, + std::vector&) = 0; }; } + #endif + // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE // ----------------------------------------------------------------------------- diff --git a/lib/V8/V8LineEditor.h b/lib/V8/V8LineEditor.h index 6ff4a847f8..22ef2ce35c 100644 --- a/lib/V8/V8LineEditor.h +++ b/lib/V8/V8LineEditor.h @@ -58,9 +58,12 @@ class V8Completer : public Completer { } state; - virtual bool isComplete(std::string const&, size_t lineno, size_t column); + virtual bool isComplete (std::string const&, + size_t lineno, + size_t column); - virtual void getAlternatives(char const *, vector &); + virtual void getAlternatives (char const*, + std::vector&); }; // ----------------------------------------------------------------------------- @@ -71,10 +74,10 @@ class V8Completer : public Completer { /// @brief line editor //////////////////////////////////////////////////////////////////////////////// - class V8LineEditor : public LineEditor { - V8LineEditor (LineEditor const&); - V8LineEditor& operator= (LineEditor const&); + + V8LineEditor (LineEditor const&) = delete; + V8LineEditor& operator= (LineEditor const&) = delete; // ----------------------------------------------------------------------------- // --SECTION-- constructors and destructors @@ -94,20 +97,16 @@ class V8LineEditor : public LineEditor { ~V8LineEditor (); -// ----------------------------------------------------------------------------- -// --SECTION-- public methods -// ----------------------------------------------------------------------------- - - // ----------------------------------------------------------------------------- // --SECTION-- protected methods // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// -/// @brief creates a concrete Shell with the correct parameter (Completer!!) +/// @brief creates a concrete Shell with the correct parameter (Completer!!) //////////////////////////////////////////////////////////////////////////////// -protected: + protected: + virtual void initializeShell(); // -----------------------------------------------------------------------------