empty exception name bug fixed
authorAlessandro Maraschini <alessandro.maraschini@elsagdatamat.com>
Wed, 16 Feb 2005 14:15:47 +0000 (14:15 +0000)
committerAlessandro Maraschini <alessandro.maraschini@elsagdatamat.com>
Wed, 16 Feb 2005 14:15:47 +0000 (14:15 +0000)
org.glite.wms-utils.exception/src/Exception.cpp

index 810758b..38c086d 100644 (file)
@@ -12,14 +12,14 @@ namespace wmsutils{
 namespace exception {
 using namespace std ;
 pthread_mutex_t METHOD_MUTEX  ;  // This mutex is used in order to lock the file for writing log infornation
+
 /* *********************************
 * Exception Class Implementation
 ************************************/
 //Constructor/Destructor
-
 Exception::Exception () {
        line = 0;
-} ;
+};
 
 Exception::~Exception() throw(){ }
 
@@ -33,7 +33,6 @@ void Exception::push_back (const string& source, int line_number,  const string&
        line = line_number;
        method_name = method;
        error_message = "";
-       exception_name = "";
 }
 
 Exception::Exception( const std::string& file, int line_number,  const std::string& method,  int code, const std::string& name)
@@ -59,8 +58,7 @@ int Exception::getCode(){
 
 const char* Exception::what() const throw(){
   if (!ancestor.empty()) return ancestor.c_str();
-  return error_message.c_str();
+   return error_message.c_str();
 };
 
 string Exception::getExceptionName(){
@@ -98,17 +96,14 @@ vector<string> Exception::getStackTrace(){
 
 string Exception::dbgMessage(){
    string result ;
-   //Adding exception Name
-   result = exception_name;
-   
+   result = "";
+   // Exception name should be displayed only once
+   if (stack_strings.size()==0){result +=exception_name;};
    //Adding error msg
    if (error_message!="") result +=": " + string(what());
-   
    if (result != "") result+="\n";
-   
    //Adding  Source
    result +="\tat " + method_name  +"[" +source_file;
-   
    //Adding line number
    if (line!=0){
       char buffer [1024] ;