summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-04-23 16:10:55 +0200
committerZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-04-23 16:10:55 +0200
commit7b2d4874b7bd992ef3f09124b7ebbc346eba01f4 (patch)
tree82d62057cf9cae9b4a1fca46f9f30693d92a3f6e
parent4fa35669bd72794b1acae57c98e57297d9e65794 (diff)
downloadabrt-7b2d4874b7bd992ef3f09124b7ebbc346eba01f4.tar.gz
abrt-7b2d4874b7bd992ef3f09124b7ebbc346eba01f4.tar.xz
abrt-7b2d4874b7bd992ef3f09124b7ebbc346eba01f4.zip
added new abrt exceptions
-rw-r--r--lib/MiddleWare/ABRTPlugin.cpp17
-rw-r--r--lib/MiddleWare/CrashTypes.h1
-rw-r--r--lib/MiddleWare/DynamicLibrary.cpp5
-rw-r--r--lib/MiddleWare/MiddleWare.cpp260
-rw-r--r--lib/MiddleWare/MiddleWare.h20
-rw-r--r--lib/MiddleWare/PluginManager.cpp8
-rw-r--r--lib/Plugins/Bugzilla.cpp16
-rw-r--r--lib/Plugins/CCpp.cpp17
-rw-r--r--lib/Plugins/Kerneloops.cpp9
-rw-r--r--lib/Plugins/Logger.cpp4
-rw-r--r--lib/Plugins/Mailx.cpp9
-rw-r--r--lib/Plugins/RunApp.cpp3
-rw-r--r--lib/Plugins/SQLite3.cpp14
-rw-r--r--lib/Utils/DebugDump.cpp39
-rw-r--r--lib/Utils/DebugDump.h1
-rw-r--r--src/Daemon/CrashWatcher.cpp4
16 files changed, 232 insertions, 195 deletions
diff --git a/lib/MiddleWare/ABRTPlugin.cpp b/lib/MiddleWare/ABRTPlugin.cpp
index 788d5c9e..56e58b94 100644
--- a/lib/MiddleWare/ABRTPlugin.cpp
+++ b/lib/MiddleWare/ABRTPlugin.cpp
@@ -26,20 +26,9 @@ CABRTPlugin::CABRTPlugin(const std::string& pLibPath) :
m_pPluginInfo(NULL),
m_pFnPluginNew(NULL)
{
- try
- {
- m_pDynamicLibrary = new CDynamicLibrary(pLibPath);
- if (m_pDynamicLibrary == NULL)
- {
- throw std::string("Not enought memory.");
- }
- m_pPluginInfo = (p_plugin_info_t) m_pDynamicLibrary->FindSymbol("plugin_info");
- m_pFnPluginNew = (p_fn_plugin_new_t) m_pDynamicLibrary->FindSymbol("plugin_new");
- }
- catch (...)
- {
- throw;
- }
+ m_pDynamicLibrary = new CDynamicLibrary(pLibPath);
+ m_pPluginInfo = reinterpret_cast<p_plugin_info_t>(m_pDynamicLibrary->FindSymbol("plugin_info"));
+ m_pFnPluginNew = reinterpret_cast<p_fn_plugin_new_t>(m_pDynamicLibrary->FindSymbol("plugin_new"));
}
CABRTPlugin::~CABRTPlugin()
diff --git a/lib/MiddleWare/CrashTypes.h b/lib/MiddleWare/CrashTypes.h
index 4c2a2e45..d53e6802 100644
--- a/lib/MiddleWare/CrashTypes.h
+++ b/lib/MiddleWare/CrashTypes.h
@@ -36,6 +36,7 @@
#define CD_MWANALYZER "_MWAnalyzer"
#define CD_MWUID "_MWUID"
#define CD_MWUUID "_MWUUID"
+#define CD_MWDDD "_MWDDD"
// now, size of a vecor is always 3 -> <type, editable, content>
typedef std::vector<std::string> vector_strings_t;
diff --git a/lib/MiddleWare/DynamicLibrary.cpp b/lib/MiddleWare/DynamicLibrary.cpp
index 3fcc548c..ffb2a6e4 100644
--- a/lib/MiddleWare/DynamicLibrary.cpp
+++ b/lib/MiddleWare/DynamicLibrary.cpp
@@ -20,6 +20,7 @@
*/
#include "DynamicLibrary.h"
+#include "ABRTException.h"
#include <iostream>
#include <dlfcn.h>
@@ -43,7 +44,7 @@ void CDynamicLibrary::Load(const std::string& pPath)
m_pHandle = dlopen(pPath.c_str(), RTLD_NOW);
if (m_pHandle == NULL)
{
- throw "CDynamicLibrary::Load(): Cannot load " + pPath + " : " + std::string(dlerror());
+ throw CABRTException(EXCEP_DL, "CDynamicLibrary::Load(): Cannot load " + pPath + " : " + std::string(dlerror()));
}
}
@@ -52,7 +53,7 @@ void* CDynamicLibrary::FindSymbol(const std::string& pName)
void* sym = dlsym(m_pHandle, pName.c_str());
if (sym == NULL)
{
- throw "CDynamicLibrary::Load(): Cannot find symbol '" + pName + "'";
+ throw CABRTException(EXCEP_DL, "CDynamicLibrary::Load(): Cannot find symbol '" + pName + "'");
}
return sym;
}
diff --git a/lib/MiddleWare/MiddleWare.cpp b/lib/MiddleWare/MiddleWare.cpp
index bc8e9de9..bed81bbf 100644
--- a/lib/MiddleWare/MiddleWare.cpp
+++ b/lib/MiddleWare/MiddleWare.cpp
@@ -21,6 +21,8 @@
#include "MiddleWare.h"
#include "DebugDump.h"
+#include "ABRTException.h"
+#include <iostream>
CMiddleWare::CMiddleWare(const std::string& pPlugisConfDir,
const std::string& pPlugisLibDir) :
@@ -39,20 +41,21 @@ CMiddleWare::~CMiddleWare()
void CMiddleWare::DebugDumpToCrashReport(const std::string& pDebugDumpDir, map_crash_report_t& pCrashReport)
{
+ std::string fileName;
+ std::string content;
+ bool isTextFile;
CDebugDump dd;
dd.Open(pDebugDumpDir);
- std::string fileName, content;
- bool isTextFile;
- if (!dd.Exist(FILENAME_UUID) ||
- !dd.Exist(FILENAME_ARCHITECTURE) ||
+ if (!dd.Exist(FILENAME_ARCHITECTURE) ||
!dd.Exist(FILENAME_KERNEL) ||
!dd.Exist(FILENAME_PACKAGE) ||
!dd.Exist(FILENAME_RELEASE) ||
!dd.Exist(FILENAME_EXECUTABLE))
{
+ dd.Delete();
dd.Close();
- throw std::string("CMiddleWare::DebugDumpToCrashReport(): One or more of important file(s)'re missing.");
+ throw CABRTException(EXCEP_ERROR, "CMiddleWare::DebugDumpToCrashReport(): One or more of important file(s)'re missing.");
}
pCrashReport.clear();
dd.InitGetNextFile();
@@ -68,8 +71,7 @@ void CMiddleWare::DebugDumpToCrashReport(const std::string& pDebugDumpDir, map_c
}
else
{
- if (fileName == FILENAME_UUID ||
- fileName == FILENAME_ARCHITECTURE ||
+ if (fileName == FILENAME_ARCHITECTURE ||
fileName == FILENAME_KERNEL ||
fileName == FILENAME_PACKAGE ||
fileName == FILENAME_RELEASE ||
@@ -128,9 +130,9 @@ void CMiddleWare::CreateReport(const std::string& pAnalyzer,
return analyzer->CreateReport(pDebugDumpDir);
}
-void CMiddleWare::CreateCrashReport(const std::string& pUUID,
- const std::string& pUID,
- map_crash_report_t& pCrashReport)
+int CMiddleWare::CreateCrashReport(const std::string& pUUID,
+ const std::string& pUID,
+ map_crash_report_t& pCrashReport)
{
CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase);
database_row_t row;
@@ -140,50 +142,74 @@ void CMiddleWare::CreateCrashReport(const std::string& pUUID,
if (pUUID == "" || row.m_sUUID != pUUID)
{
- throw std::string("CMiddleWare::CreateCrashReport(): UUID '"+pUUID+"' is not in database.");
+ throw CABRTException(EXCEP_ERROR, "CMiddleWare::CreateCrashReport(): UUID '"+pUUID+"' is not in database.");
}
- std::string analyzer;
- std::string UUID;
- CDebugDump dd;
- dd.Open(row.m_sDebugDumpDir);
-
- dd.LoadText(FILENAME_ANALYZER, analyzer);
try
{
+ std::string analyzer;
+ std::string gUUID;
+ CDebugDump dd;
+ dd.Open(row.m_sDebugDumpDir);
+ dd.LoadText(FILENAME_ANALYZER, analyzer);
+ dd.Close();
+
CreateReport(analyzer, row.m_sDebugDumpDir);
+
+ gUUID = GetGlobalUUID(analyzer, row.m_sDebugDumpDir);
+
+ RunAnalyzerActions(analyzer, row.m_sDebugDumpDir);
+ DebugDumpToCrashReport(row.m_sDebugDumpDir, pCrashReport);
+
+ add_crash_data_to_crash_report(pCrashReport, CD_UUID, CD_TXT, CD_ISNOTEDITABLE, gUUID);
+ add_crash_data_to_crash_report(pCrashReport, CD_MWANALYZER, CD_SYS, CD_ISNOTEDITABLE, analyzer);
+ add_crash_data_to_crash_report(pCrashReport, CD_MWUID, CD_SYS, CD_ISNOTEDITABLE, pUID);
+ add_crash_data_to_crash_report(pCrashReport, CD_MWUUID, CD_SYS, CD_ISNOTEDITABLE, pUUID);
+ add_crash_data_to_crash_report(pCrashReport, CD_COMMENT, CD_TXT, CD_ISEDITABLE, "");
+ add_crash_data_to_crash_report(pCrashReport, CD_REPRODUCE, CD_TXT, CD_ISEDITABLE, "1.\n2.\n3.\n");
}
- catch (...)
+ catch (CABRTException& e)
{
- dd.Close();
- throw;
+ if (e.type() == EXCEP_DD_LOAD)
+ {
+ DeleteCrashInfo(row.m_sUID, row.m_sUUID, true);
+ }
+ else if (e.type() == EXCEP_DD_OPEN)
+ {
+ DeleteCrashInfo(row.m_sUUID, row.m_sUID, false);
+ }
+ std::cerr << "CMiddleWare::CreateCrashReport(): " << e.what() << std::endl;
+ return 0;
}
- UUID = GetGlobalUUID(analyzer, row.m_sDebugDumpDir);
-
- dd.SaveText(FILENAME_UUID, UUID);
- dd.Close();
-
- RunAnalyzerActions(analyzer, row.m_sDebugDumpDir);
- DebugDumpToCrashReport(row.m_sDebugDumpDir, pCrashReport);
- add_crash_data_to_crash_report(pCrashReport, CD_MWANALYZER, CD_SYS, CD_ISNOTEDITABLE, analyzer);
- add_crash_data_to_crash_report(pCrashReport, CD_MWUID, CD_SYS, CD_ISNOTEDITABLE, pUID);
- add_crash_data_to_crash_report(pCrashReport, CD_MWUUID, CD_SYS, CD_ISNOTEDITABLE, pUUID);
- add_crash_data_to_crash_report(pCrashReport, CD_COMMENT, CD_TXT, CD_ISEDITABLE, "");
- add_crash_data_to_crash_report(pCrashReport, CD_REPRODUCE, CD_TXT, CD_ISEDITABLE, "1.\n2.\n3.\n");
+ return 1;
}
void CMiddleWare::Report(const std::string& pDebugDumpDir)
{
map_crash_report_t crashReport;
- DebugDumpToCrashReport(pDebugDumpDir, crashReport);
+ try
+ {
+ DebugDumpToCrashReport(pDebugDumpDir, crashReport);
+ }
+ catch (CABRTException& e)
+ {
+ std::cerr << "CMiddleWare::Report(): " << e.what() << std::endl;
+ }
set_reporters_t::iterator it_r;
for (it_r = m_setReporters.begin(); it_r != m_setReporters.end(); it_r++)
{
- CReporter* reporter = m_pPluginManager->GetReporter((*it_r).first);
- reporter->Report(crashReport, (*it_r).second);
+ try
+ {
+ CReporter* reporter = m_pPluginManager->GetReporter((*it_r).first);
+ reporter->Report(crashReport, (*it_r).second);
+ }
+ catch (CABRTException& e)
+ {
+ std::cerr << "CMiddleWare::Report(): " << e.what() << std::endl;
+ }
}
}
@@ -193,7 +219,7 @@ void CMiddleWare::Report(const map_crash_report_t& pCrashReport)
pCrashReport.find(CD_MWUID) == pCrashReport.end() ||
pCrashReport.find(CD_MWUUID) == pCrashReport.end())
{
- throw std::string("CMiddleWare::Report(): Important data are missing.");
+ throw CABRTException(EXCEP_ERROR, "CMiddleWare::Report(): System data are missing in crash report.");
}
std::string analyzer = pCrashReport.find(CD_MWANALYZER)->second[CD_CONTENT];
std::string UID = pCrashReport.find(CD_MWUID)->second[CD_CONTENT];
@@ -206,8 +232,15 @@ void CMiddleWare::Report(const map_crash_report_t& pCrashReport)
it_r != m_mapAnalyzerReporters[analyzer].end();
it_r++)
{
- CReporter* reporter = m_pPluginManager->GetReporter((*it_r).first);
- reporter->Report(pCrashReport, (*it_r).second);
+ try
+ {
+ CReporter* reporter = m_pPluginManager->GetReporter((*it_r).first);
+ reporter->Report(pCrashReport, (*it_r).second);
+ }
+ catch (CABRTException& e)
+ {
+ std::cerr << "CMiddleWare::Report(): " << e.what() << std::endl;
+ }
}
}
@@ -243,18 +276,13 @@ void CMiddleWare::DeleteCrashInfo(const std::string& pUUID,
}
-bool CMiddleWare::IsDebugDumpSaved(const std::string& pDebugDumpDir)
+bool CMiddleWare::IsDebugDumpSaved(const std::string& pUID,
+ const std::string& pDebugDumpDir)
{
- std::string UID;
- CDebugDump dd;
- dd.Open(pDebugDumpDir);
- dd.LoadText(FILENAME_UID, UID);
- dd.Close();
-
CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase);
vector_database_rows_t rows;
database->Connect();
- rows = database->GetUIDData(UID);
+ rows = database->GetUIDData(pUID);
database->DisConnect();
int ii;
@@ -271,37 +299,32 @@ bool CMiddleWare::IsDebugDumpSaved(const std::string& pDebugDumpDir)
return found;
}
-int CMiddleWare::SavePackageDescriptionToDebugDump(const std::string& pDebugDumpDir)
+int CMiddleWare::SavePackageDescriptionToDebugDump(const std::string& pExecutable,
+ const std::string& pDebugDumpDir)
{
std::string package;
std::string packageName;
- std::string executable;
- CDebugDump dd;
- dd.Open(pDebugDumpDir);
- dd.LoadText(FILENAME_EXECUTABLE, executable);
- if (executable == "kernel")
+ if (pExecutable == "kernel")
{
packageName = package = "kernel";
}
else
{
- package = m_RPM.GetPackage(executable);
+ package = m_RPM.GetPackage(pExecutable);
packageName = package.substr(0, package.rfind("-", package.rfind("-") - 1));
if (packageName == "" ||
(m_setBlackList.find(packageName) != m_setBlackList.end()))
{
- dd.Delete();
- dd.Close();
+ DeleteDebugDumpDir(pDebugDumpDir);
return 0;
}
if (m_bOpenGPGCheck)
{
if (!m_RPM.CheckFingerprint(packageName) ||
- !m_RPM.CheckHash(packageName, executable))
+ !m_RPM.CheckHash(packageName, pExecutable))
{
- dd.Delete();
- dd.Close();
+ DeleteDebugDumpDir(pDebugDumpDir);
return 0;
}
}
@@ -309,25 +332,10 @@ int CMiddleWare::SavePackageDescriptionToDebugDump(const std::string& pDebugDump
std::string description = m_RPM.GetDescription(packageName);
- dd.SaveText(FILENAME_PACKAGE, package);
- dd.SaveText(FILENAME_DESCRIPTION, description);
- dd.Close();
-
- return 1;
-}
-
-int CMiddleWare::SaveUUIDToDebugDump(const std::string& pDebugDumpDir)
-{
- std::string analyzer;
- std::string UUID;
CDebugDump dd;
dd.Open(pDebugDumpDir);
-
-
- dd.LoadText(FILENAME_ANALYZER, analyzer);
- UUID = GetLocalUUID(analyzer, pDebugDumpDir);
-
- dd.SaveText(FILENAME_UUID, UUID);
+ dd.SaveText(FILENAME_PACKAGE, package);
+ dd.SaveText(FILENAME_DESCRIPTION, description);
dd.Close();
return 1;
@@ -342,50 +350,44 @@ void CMiddleWare::RunAnalyzerActions(const std::string& pAnalyzer, const std::st
it_a != m_mapAnalyzerActions[pAnalyzer].end();
it_a++)
{
- CAction* action = m_pPluginManager->GetAction((*it_a).first);
- action->Run(pDebugDumpDir, (*it_a).second);
+ try
+ {
+ CAction* action = m_pPluginManager->GetAction((*it_a).first);
+ action->Run(pDebugDumpDir, (*it_a).second);
+ }
+ catch (CABRTException& e)
+ {
+ std::cerr << "CMiddleWare::RunAnalyzerActions(): " << e.what() << std::endl;
+ }
}
}
}
-int CMiddleWare::SaveDebugDumpToDatabase(const std::string& pDebugDumpDir, map_crash_info_t& pCrashInfo)
+int CMiddleWare::SaveDebugDumpToDatabase(const std::string& pUUID,
+ const std::string& pUID,
+ const std::string& pTime,
+ const std::string& pDebugDumpDir,
+ map_crash_info_t& pCrashInfo)
{
CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase);
- std::string UUID;
- std::string UID;
- std::string time;
-
- CDebugDump dd;
- dd.Open(pDebugDumpDir);
-
- dd.LoadText(FILENAME_TIME, time);
- dd.LoadText(FILENAME_UID, UID);
- dd.LoadText(FILENAME_UUID, UUID);
-
database_row_t row;
database->Connect();
- database->Insert(UUID, UID, pDebugDumpDir, time);
- row = database->GetUUIDData(UUID, UID);
+ database->Insert(pUUID, pUID, pDebugDumpDir, pTime);
+ row = database->GetUUIDData(pUUID, pUID);
database->DisConnect();
-
if (row.m_sReported == "1")
{
- dd.Delete();
- dd.Close();
+ DeleteDebugDumpDir(pDebugDumpDir);
return 0;
}
- pCrashInfo = GetCrashInfo(UUID, UID);
-
+ pCrashInfo = GetCrashInfo(pUUID, pUID);
if (row.m_sCount != "1")
{
- dd.Delete();
- dd.Close();
+ DeleteDebugDumpDir(pDebugDumpDir);
return 2;
}
- dd.Close();
-
return 1;
}
@@ -397,23 +399,49 @@ int CMiddleWare::SaveDebugDump(const std::string& pDebugDumpDir)
int CMiddleWare::SaveDebugDump(const std::string& pDebugDumpDir, map_crash_info_t& pCrashInfo)
{
- if (IsDebugDumpSaved(pDebugDumpDir))
- {
- return 0;
- }
- if (!SavePackageDescriptionToDebugDump(pDebugDumpDir))
+ std::string lUUID;
+ std::string UID;
+ std::string time;
+ std::string analyzer;
+ std::string executable;
+ CDebugDump dd;
+
+ try
{
- return 0;
+ dd.Open(pDebugDumpDir);
+ dd.LoadText(FILENAME_TIME, time);
+ dd.LoadText(FILENAME_UID, UID);
+ dd.LoadText(FILENAME_ANALYZER, analyzer);
+ dd.LoadText(FILENAME_EXECUTABLE, executable);
+ dd.Close();
+
+ if (IsDebugDumpSaved(UID, pDebugDumpDir))
+ {
+ return 0;
+ }
+ if (!SavePackageDescriptionToDebugDump(executable, pDebugDumpDir))
+ {
+ return 0;
+ }
+
+ lUUID = GetLocalUUID(analyzer, pDebugDumpDir);
+
+ return SaveDebugDumpToDatabase(lUUID, UID, time, pDebugDumpDir, pCrashInfo);
}
- if (!SaveUUIDToDebugDump(pDebugDumpDir))
+ catch (CABRTException& e)
{
+ if (e.type() == EXCEP_DD_LOAD ||
+ e.type() == EXCEP_DD_SAVE)
+ {
+ DeleteDebugDumpDir(pDebugDumpDir);
+ }
+ std::cerr << "CMiddleWare::SaveDebugDump(): " << e.what() << std::endl;
return 0;
}
- return SaveDebugDumpToDatabase(pDebugDumpDir, pCrashInfo);
}
map_crash_info_t CMiddleWare::GetCrashInfo(const std::string& pUUID,
- const std::string& pUID)
+ const std::string& pUID)
{
map_crash_info_t crashInfo;
CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase);
@@ -427,9 +455,13 @@ map_crash_info_t CMiddleWare::GetCrashInfo(const std::string& pUUID,
{
dd.Open(row.m_sDebugDumpDir);
}
- catch (std::string sErr)
+ catch (CABRTException& e)
{
- DeleteCrashInfo(row.m_sUUID, row.m_sUID, false);
+ if (e.type() == EXCEP_DD_OPEN)
+ {
+ DeleteCrashInfo(row.m_sUUID, row.m_sUID, false);
+ }
+ std::cerr << "CMiddleWare::GetCrashInfo(): " << e.what() << std::endl;
return crashInfo;
}
@@ -446,6 +478,7 @@ map_crash_info_t CMiddleWare::GetCrashInfo(const std::string& pUUID,
add_crash_data_to_crash_info(crashInfo, CD_COUNT, row.m_sCount);
add_crash_data_to_crash_info(crashInfo, CD_TIME, row.m_sTime);
add_crash_data_to_crash_info(crashInfo, CD_REPORTED, row.m_sReported);
+ add_crash_data_to_crash_info(crashInfo, CD_MWDDD, row.m_sDebugDumpDir);
return crashInfo;
}
@@ -464,7 +497,10 @@ vector_crash_infos_t CMiddleWare::GetCrashInfos(const std::string& pUID)
for (ii = 0; ii < rows.size(); ii++)
{
map_crash_info_t info = GetCrashInfo(rows[ii].m_sUUID, rows[ii].m_sUID);
- infos.push_back(info);
+ if (info[CD_UUID][CD_CONTENT] != "")
+ {
+ infos.push_back(info);
+ }
}
return infos;
diff --git a/lib/MiddleWare/MiddleWare.h b/lib/MiddleWare/MiddleWare.h
index 4ec3df3a..c3b47a4f 100644
--- a/lib/MiddleWare/MiddleWare.h
+++ b/lib/MiddleWare/MiddleWare.h
@@ -55,15 +55,17 @@ class CMiddleWare
std::string GetGlobalUUID(const std::string& pAnalyzer,
const std::string& pDebugDumpDir);
void CreateReport(const std::string& pAnalyzer,
- const std::string& pDebugDumpDir);
+ const std::string& pDebugDumpDir);
void RunAnalyzerActions(const std::string& pAnalyzer, const std::string& pDebugDumpDir);
void DebugDumpToCrashReport(const std::string& pDebugDumpDir,
map_crash_report_t& pCrashReport);
-
- bool IsDebugDumpSaved(const std::string& pDebugDumpDir);
- int SavePackageDescriptionToDebugDump(const std::string& pDebugDumpDir);
- int SaveUUIDToDebugDump(const std::string& pDebugDumpDir);
- int SaveDebugDumpToDatabase(const std::string& pDebugDumpDir, map_crash_info_t& pCrashInfo);
+ bool IsDebugDumpSaved(const std::string& pUID, const std::string& pDebugDumpDir);
+ int SavePackageDescriptionToDebugDump(const std::string& pExecutable, const std::string& pDebugDumpDir);
+ int SaveDebugDumpToDatabase(const std::string& pUUID,
+ const std::string& pUID,
+ const std::string& pTime,
+ const std::string& pDebugDumpDir,
+ map_crash_info_t& pCrashInfo);
map_crash_info_t GetCrashInfo(const std::string& pUUID,
const std::string& pUID);
@@ -77,9 +79,9 @@ class CMiddleWare
void RegisterPlugin(const std::string& pName);
void UnRegisterPlugin(const std::string& pName);
- void CreateCrashReport(const std::string& pUUID,
- const std::string& pUID,
- map_crash_report_t& pCrashReport);
+ int CreateCrashReport(const std::string& pUUID,
+ const std::string& pUID,
+ map_crash_report_t& pCrashReport);
void Report(const std::string& pDebugDumpDir);
void Report(const map_crash_report_t& pCrashReport);
diff --git a/lib/MiddleWare/PluginManager.cpp b/lib/MiddleWare/PluginManager.cpp
index cbdd2c1f..2ab314bb 100644
--- a/lib/MiddleWare/PluginManager.cpp
+++ b/lib/MiddleWare/PluginManager.cpp
@@ -21,6 +21,7 @@
#include <iostream>
#include "PluginManager.h"
+#include <ABRTException.h>
#include <dirent.h>
#include <stdio.h>
#include <sys/types.h>
@@ -80,18 +81,19 @@ void CPluginManager::LoadPlugin(const std::string& pName)
if (abrtPlugin->GetMagicNumber() != PLUGINS_MAGIC_NUMBER ||
(abrtPlugin->GetType() < ANALYZER && abrtPlugin->GetType() > DATABASE))
{
- throw std::string("non-compatible plugin");
+ throw CABRTException(EXCEP_PLUGIN, "CPluginManager::LoadPlugin(): non-compatible plugin");
}
std::cerr << "Plugin " << pName << " (" << abrtPlugin->GetVersion() << ") " << "succesfully loaded." << std::endl;
m_mapABRTPlugins[pName] = abrtPlugin;
}
- catch (std::string sError)
+ catch (CABRTException& e)
{
if (abrtPlugin != NULL)
{
delete abrtPlugin;
}
- std::cerr << "Failed to load plugin " << pName << " (" << sError << ")." << std::endl;
+ std::cerr << e.what() << std::endl;
+ std::cerr << "Failed to load plugin " << pName << std::endl;
}
}
}
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index e43bc85c..ed9e02c2 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -3,6 +3,7 @@
#include "CrashTypes.h"
#include "PluginSettings.h"
#include "DebugDump.h"
+#include "ABRTException.h"
#include <iostream>
CReporterBugzilla::CReporterBugzilla() :
@@ -17,6 +18,7 @@ CReporterBugzilla::~CReporterBugzilla()
{
delete m_pXmlrpcTransport;
delete m_pXmlrpcClient;
+ delete m_pCarriageParm;
}
void CReporterBugzilla::Login()
@@ -36,7 +38,7 @@ void CReporterBugzilla::Login()
}
catch (std::exception& e)
{
- throw std::string(e.what());
+ throw CABRTException(EXCEP_PLUGIN, std::string("CReporterBugzilla::Login(): ") + e.what());
}
}
@@ -51,7 +53,7 @@ void CReporterBugzilla::Logout()
}
catch (std::exception& e)
{
- throw std::string(e.what());
+ throw CABRTException(EXCEP_PLUGIN, std::string("CReporterBugzilla::Logout(): ") + e.what());
}
}
@@ -70,7 +72,7 @@ bool CReporterBugzilla::CheckUUIDInBugzilla(const std::string& pComponent, const
}
catch (std::exception& e)
{
- throw std::string(e.what());
+ throw CABRTException(EXCEP_PLUGIN, std::string("CReporterBugzilla::CheckUUIDInBugzilla(): ") + e.what());
}
ret = xmlrpc_c::value_struct(rpc->getResult());
std::vector<xmlrpc_c::value> bugs = xmlrpc_c::value_array(ret["bugs"]).vectorValueValue();
@@ -96,7 +98,7 @@ void CReporterBugzilla::CreateNewBugDescription(const map_crash_report_t& pCrash
{
if (it->second[CD_TYPE] == CD_TXT || it->second[CD_TYPE] == CD_ATT)
{
- if (it->first != FILENAME_UUID &&
+ if (it->first != CD_UUID &&
it->first != FILENAME_ARCHITECTURE &&
it->first != FILENAME_RELEASE &&
it->first != CD_REPRODUCE &&
@@ -144,7 +146,7 @@ void CReporterBugzilla::NewBug(const map_crash_report_t& pCrashReport)
bugParams["version"] = xmlrpc_c::value_string(version);
bugParams["summary"] = xmlrpc_c::value_string("[abrt] crash detected in " + component);
bugParams["description"] = xmlrpc_c::value_string(description);
- bugParams["status_whiteboard"] = xmlrpc_c::value_string("abrt_hash:" + pCrashReport.find(FILENAME_UUID)->second[CD_CONTENT]);
+ bugParams["status_whiteboard"] = xmlrpc_c::value_string("abrt_hash:" + pCrashReport.find(CD_UUID)->second[CD_CONTENT]);
bugParams["platform"] = xmlrpc_c::value_string(pCrashReport.find(FILENAME_ARCHITECTURE)->second[CD_CONTENT]);
paramList.add(xmlrpc_c::value_struct(bugParams));
@@ -157,7 +159,7 @@ void CReporterBugzilla::NewBug(const map_crash_report_t& pCrashReport)
}
catch (std::exception& e)
{
- throw std::string(e.what());
+ throw CABRTException(EXCEP_PLUGIN, std::string("CReporterBugzilla::NewBug(): ") + e.what());
}
}
@@ -166,7 +168,7 @@ void CReporterBugzilla::Report(const map_crash_report_t& pCrashReport, const std
{
std::string package = pCrashReport.find(FILENAME_PACKAGE)->second[CD_CONTENT];
std::string component = package.substr(0, package.rfind("-", package.rfind("-")-1));
- std::string uuid = pCrashReport.find(FILENAME_UUID)->second[CD_CONTENT];
+ std::string uuid = pCrashReport.find(CD_UUID)->second[CD_CONTENT];
Login();
if (!CheckUUIDInBugzilla(component, uuid))
{
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index 76571f32..286f730f 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -20,9 +20,10 @@
*/
#include "CCpp.h"
-#include <fstream>
+#include "ABRTException.h"
#include "DebugDump.h"
#include "PluginSettings.h"
+#include <fstream>
#include <sstream>
#include <iostream>
#include <ctype.h>
@@ -70,7 +71,7 @@ std::string CAnalyzerCCpp::CreateHash(const std::string& pInput)
hc = HASH_Create(HASH_AlgSHA1);
if (!hc)
{
- throw std::string("CAnalyzerCCpp::CreateHash(): cannot initialize hash.");
+ throw CABRTException(EXCEP_PLUGIN, "CAnalyzerCCpp::CreateHash(): cannot initialize hash.");
}
HASH_Begin(hc);
HASH_Update(hc, reinterpret_cast<const unsigned char*>(pInput.c_str()), pInput.length());
@@ -104,7 +105,7 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)
m_Pid = child;
if (child < 0)
{
- throw std::string("CAnalyzerCCpp::RunGdb(): fork failed.");
+ throw CABRTException(EXCEP_PLUGIN, "CAnalyzerCCpp::RunGdb(): fork failed.");
}
if (child == 0)
{
@@ -164,7 +165,7 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)
close(pipeout[0]);
kill(child, SIGTERM);
wait(NULL);
- throw std::string("CAnalyzerCCpp::InstallDebugInfos(): cannot install debuginfos for ") + pPackage;
+ throw CABRTException(EXCEP_PLUGIN, "CAnalyzerCCpp::InstallDebugInfos(): cannot install debuginfos for " + pPackage);
}
if (strstr(buff, "Total download size") != NULL)
{
@@ -175,7 +176,7 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)
close(pipeout[0]);
kill(child, SIGTERM);
wait(NULL);
- throw std::string("CAnalyzerCCpp::InstallDebugInfos(): cannot install debuginfos for ") + pPackage;
+ throw CABRTException(EXCEP_PLUGIN, "CAnalyzerCCpp::InstallDebugInfos(): cannot install debuginfos for " + pPackage);
}
}
}
@@ -211,7 +212,7 @@ void CAnalyzerCCpp::GetBacktrace(const std::string& pDebugDumpDir, std::string&
}
else
{
- throw "CAnalyzerCCpp::GetBacktrace(): cannot create gdb script " + tmpFile ;
+ throw CABRTException(EXCEP_PLUGIN, "CAnalyzerCCpp::GetBacktrace(): cannot create gdb script " + tmpFile);
}
char* command = (char*)"gdb";
char* args[5] = { (char*)"gdb", (char*)"-batch", (char*)"-x", NULL, NULL };
@@ -361,7 +362,7 @@ void CAnalyzerCCpp::ExecVP(const char* pCommand, char* const pArgs[], const std:
m_Pid = child;
if (child == -1)
{
- throw std::string("CAnalyzerCCpp::RunGdb(): fork failed.");
+ CABRTException(EXCEP_PLUGIN, "CAnalyzerCCpp::RunGdb(): fork failed.");
}
if(child == 0)
{
@@ -497,7 +498,7 @@ void CAnalyzerCCpp::Init()
}
if (NSS_NoDB_Init(NULL) != SECSuccess)
{
- throw std::string("CAnalyzerCCpp::CreateHash(): cannot initialize NSS library.");
+ throw CABRTException(EXCEP_PLUGIN, "CAnalyzerCCpp::CreateHash(): cannot initialize NSS library.");
}
}
diff --git a/lib/Plugins/Kerneloops.cpp b/lib/Plugins/Kerneloops.cpp
index 144fac8d..179ba410 100644
--- a/lib/Plugins/Kerneloops.cpp
+++ b/lib/Plugins/Kerneloops.cpp
@@ -28,6 +28,7 @@
#include "KerneloopsSysLog.h"
#include "DebugDump.h"
#include "PluginSettings.h"
+#include "ABRTException.h"
#include <sstream>
#include <assert.h>
@@ -91,7 +92,7 @@ void CAnalyzerKerneloops::Report()
time_t t = time(NULL);
if (((time_t) -1) == t)
{
- throw std::string("CAnalyzerKerneloops::Report(): cannot get local time.");
+ throw CABRTException(EXCEP_PLUGIN, "CAnalyzerKerneloops::Report(): cannot get local time.");
}
m_pOopsList = m_pSysLog.GetOopsList();
@@ -114,9 +115,9 @@ void CAnalyzerKerneloops::Report()
m_pDebugDump.SaveText(FILENAME_KERNELOOPS, m_pOops.m_sData);
m_pDebugDump.Close();
}
- catch (std::string sError)
+ catch (CABRTException& e)
{
- throw std::string("CAnalyzerKerneloops::Report(): ") + sError.c_str();
+ throw CABRTException(EXCEP_PLUGIN, "CAnalyzerKerneloops::Report(): " + e.what());
}
m_pOopsList.pop_back();
}
@@ -127,7 +128,7 @@ void CAnalyzerKerneloops::Init()
/* daemonize */
pid_t pid = fork();
if (pid < 0)
- throw std::string("CAnalyzerKerneloops::Init(): fork failed.");
+ throw CABRTException(EXCEP_PLUGIN, "CAnalyzerKerneloops::Init(): fork failed.");
/* hack: release Init() */
if (pid)
diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp
index d340b2d6..43c219f0 100644
--- a/lib/Plugins/Logger.cpp
+++ b/lib/Plugins/Logger.cpp
@@ -55,7 +55,7 @@ void CLogger::Report(const map_crash_report_t& pCrashReport, const std::string&
{
if (it->second[CD_TYPE] == CD_TXT)
{
- if (it->first != FILENAME_UUID &&
+ if (it->first != CD_UUID &&
it->first != FILENAME_ARCHITECTURE &&
it->first != FILENAME_KERNEL &&
it->first != FILENAME_PACKAGE)
@@ -64,7 +64,7 @@ void CLogger::Report(const map_crash_report_t& pCrashReport, const std::string&
additionalFiles << "-----" << std::endl;
additionalFiles << it->second[CD_CONTENT] << std::endl << std::endl;
}
- else if (it->first == FILENAME_UUID)
+ else if (it->first == CD_UUID)
{
UUIDFile << it->first << std::endl;
UUIDFile << "-----" << std::endl;
diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp
index b7cdcfe0..6a5cb59d 100644
--- a/lib/Plugins/Mailx.cpp
+++ b/lib/Plugins/Mailx.cpp
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <sstream>
#include "DebugDump.h"
+#include "ABRTException.h"
#include "PluginSettings.h"
#define MAILX_COMMAND "/bin/mailx"
@@ -48,11 +49,11 @@ void CMailx::SendEmail(const std::string& pSubject, const std::string& pText)
command = popen(mailx_command.c_str(), "w");
if (!command)
{
- throw std::string("CMailx::SendEmail: Can not execute mailx.");
+ throw CABRTException(EXCEP_PLUGIN, "CMailx::SendEmail(): Can not execute mailx.");
}
if (fputs(pText.c_str(), command) == -1)
{
- throw std::string("CMailx::SendEmail: Can not send data.");
+ throw CABRTException(EXCEP_PLUGIN, "CMailx::SendEmail(): Can not send data.");
}
pclose(command);
}
@@ -68,7 +69,7 @@ void CMailx::Report(const map_crash_report_t& pCrashReport, const std::string& p
{
if (it->second[CD_TYPE] == CD_TXT)
{
- if (it->first != FILENAME_UUID &&
+ if (it->first != CD_UUID &&
it->first != FILENAME_ARCHITECTURE &&
it->first != FILENAME_KERNEL &&
it->first != FILENAME_PACKAGE)
@@ -77,7 +78,7 @@ void CMailx::Report(const map_crash_report_t& pCrashReport, const std::string& p
additionalFiles << "-----" << std::endl;
additionalFiles << it->second[CD_CONTENT] << std::endl << std::endl;
}
- else if (it->first == FILENAME_UUID)
+ else if (it->first == CD_UUID)
{
UUIDFile << it->first << std::endl;
UUIDFile << "-----" << std::endl;
diff --git a/lib/Plugins/RunApp.cpp b/lib/Plugins/RunApp.cpp
index 9f08e05a..8a8db08a 100644
--- a/lib/Plugins/RunApp.cpp
+++ b/lib/Plugins/RunApp.cpp
@@ -23,6 +23,7 @@
#include "RunApp.h"
#include <stdio.h>
#include "DebugDump.h"
+#include "ABRTException.h"
#define COMMAND 0
#define FILENAME 1
@@ -67,7 +68,7 @@ void CActionRunApp::Run(const std::string& pDebugDumpDir,
FILE *fp = popen(args[COMMAND].c_str(), "r");
if (fp == NULL)
{
- throw "CActionRunApp::Run(): cannot execute " + args[COMMAND];
+ throw CABRTException(EXCEP_PLUGIN, "CActionRunApp::Run(): cannot execute " + args[COMMAND]);
}
while (fgets(line, 1024, fp) != NULL)
{
diff --git a/lib/Plugins/SQLite3.cpp b/lib/Plugins/SQLite3.cpp
index 9a5c6e0f..13a0ed65 100644
--- a/lib/Plugins/SQLite3.cpp
+++ b/lib/Plugins/SQLite3.cpp
@@ -25,7 +25,7 @@
#include <string>
#include <iostream>
#include "PluginSettings.h"
-
+#include "ABRTException.h"
#define ABRT_TABLE "abrt"
#define SQLITE3_MASTER_TABLE "sqlite_master"
@@ -54,7 +54,7 @@ void CSQLite3::Exec(const std::string& pCommand)
int ret = sqlite3_exec(m_pDB, pCommand.c_str(), 0, 0, &err);
if (ret != SQLITE_OK)
{
- throw std::string("SQLite3::Exec(): Error on: " + pCommand + " " + err);
+ throw CABRTException(EXCEP_PLUGIN, "SQLite3::Exec(): Error on: " + pCommand + " " + err);
}
}
@@ -66,7 +66,7 @@ void CSQLite3::GetTable(const std::string& pCommand, vector_database_rows_t& pTa
int ret = sqlite3_get_table(m_pDB, pCommand.c_str(), &table, &nrow, &ncol, &err);
if (ret != SQLITE_OK)
{
- throw std::string("SQLite3::GetTable(): Error on: " + pCommand + " " + err);
+ throw CABRTException(EXCEP_PLUGIN, "SQLite3::GetTable(): Error on: " + pCommand + " " + err);
}
pTable.clear();
int ii;
@@ -122,7 +122,7 @@ bool CSQLite3::OpenDB()
if (ret != SQLITE_OK && ret != SQLITE_CANTOPEN)
{
- throw std::string("SQLite3::CheckDB(): Could not open database. ") + sqlite3_errmsg(m_pDB);
+ throw CABRTException(EXCEP_PLUGIN, std::string("SQLite3::CheckDB(): Could not open database. ") + sqlite3_errmsg(m_pDB));
}
return ret == SQLITE_OK;
}
@@ -135,7 +135,7 @@ void CSQLite3::CreateDB()
NULL);
if(ret != SQLITE_OK)
{
- throw std::string("SQLite3::Create(): Could not create database. ") + sqlite3_errmsg(m_pDB);
+ throw CABRTException(EXCEP_PLUGIN, std::string("SQLite3::Create(): Could not create database. ") + sqlite3_errmsg(m_pDB));
}
}
@@ -208,7 +208,7 @@ void CSQLite3::Delete(const std::string& pUUID, const std::string& pUID)
}
else
{
- throw std::string("CSQLite3::Delete(): UUID is not found in DB.");
+ throw CABRTException(EXCEP_PLUGIN, "CSQLite3::Delete(): UUID is not found in DB.");
}
}
@@ -223,7 +223,7 @@ void CSQLite3::SetReported(const std::string& pUUID, const std::string& pUID)
}
else
{
- throw std::string("CSQLite3::SetReported(): UUID is not found in DB.");
+ throw CABRTException(EXCEP_PLUGIN, "CSQLite3::SetReported(): UUID is not found in DB.");
}
}
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp
index 198b668d..8dd3114f 100644
--- a/lib/Utils/DebugDump.cpp
+++ b/lib/Utils/DebugDump.cpp
@@ -20,6 +20,7 @@
*/
#include "DebugDump.h"
+#include "ABRTException.h"
#include <fstream>
#include <iostream>
#include <sstream>
@@ -46,13 +47,13 @@ void CDebugDump::Open(const std::string& pDir)
{
if (m_bOpened)
{
- throw std::string("CDebugDump::CDebugDump(): DebugDump is already opened.");
+ throw CABRTException(EXCEP_ERROR, "CDebugDump::CDebugDump(): DebugDump is already opened.");
}
m_sDebugDumpDir = pDir;
std::string lockPath = m_sDebugDumpDir + "/.lock";
if (!ExistFileDir(pDir))
{
- throw "CDebugDump::CDebugDump(): "+pDir+" does not exist.";
+ throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::CDebugDump(): "+pDir+" does not exist.");
}
Lock();
m_bOpened = true;
@@ -107,7 +108,7 @@ bool CDebugDump::GetAndSetLock(const std::string& pLockFile, const std::string&
{
remove(pLockFile.c_str());
Delete();
- throw std::string("CDebugDump::GetAndSetLock(): dead lock found");
+ throw CABRTException(EXCEP_ERROR, "CDebugDump::GetAndSetLock(): dead lock found");
}
fIn.close();
return false;
@@ -142,14 +143,14 @@ void CDebugDump::Create(const std::string& pDir)
{
if (m_bOpened)
{
- throw std::string("CDebugDump::CDebugDump(): DebugDump is already opened.");
+ throw CABRTException(EXCEP_ERROR, "CDebugDump::CDebugDump(): DebugDump is already opened.");
}
m_sDebugDumpDir = pDir;
std::string lockPath = pDir + ".lock";
if (ExistFileDir(pDir))
{
- throw "CDebugDump::CDebugDump(): "+pDir+" already exists.";
+ throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::CDebugDump(): "+pDir+" already exists.");
}
Lock();
@@ -157,7 +158,7 @@ void CDebugDump::Create(const std::string& pDir)
if (mkdir(pDir.c_str(), 0755) == -1)
{
- throw "CDebugDump::Create(): Cannot create dir: " + pDir;
+ throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::Create(): Cannot create dir: " + pDir);
}
SaveKernelArchitectureRelease();
@@ -186,14 +187,14 @@ void CDebugDump::DeleteFileDir(const std::string& pDir)
}
if (remove(fullPath.c_str()) == -1)
{
- throw "CDebugDump::DeleteFileDir(): Cannot remove file: " + fullPath;
+ throw CABRTException(EXCEP_DD_DELETE, "CDebugDump::DeleteFileDir(): Cannot remove file: " + fullPath);
}
}
}
closedir(dir);
if (remove(pDir.c_str()) == -1)
{
- throw "CDebugDump::DeleteFileDir(): Cannot remove dir: " + fullPath;
+ throw CABRTException(EXCEP_DD_DELETE, "CDebugDump::DeleteFileDir(): Cannot remove dir: " + fullPath);
}
}
}
@@ -205,21 +206,21 @@ bool CDebugDump::IsTextFile(const std::string& pName)
if (m == NULL)
{
- throw std::string("CDebugDump::IsTextFile(): Cannot open magic cookie: ") + magic_error(m);
+ throw CABRTException(EXCEP_ERROR, std::string("CDebugDump::IsTextFile(): Cannot open magic cookie: ") + magic_error(m));
}
int r = magic_load(m,NULL);
if (r == -1)
{
- throw std::string("CDebugDump::IsTextFile(): Cannot load magic db: ") + magic_error(m);
+ throw CABRTException(EXCEP_ERROR, std::string("CDebugDump::IsTextFile(): Cannot load magic db: ") + magic_error(m));
}
char* ch = (char *) magic_file(m, pName.c_str());
if (ch == NULL)
{
- throw std::string("CDebugDump::IsTextFile(): Cannot determine file type: ") + magic_error(m);
+ throw CABRTException(EXCEP_ERROR, std::string("CDebugDump::IsTextFile(): Cannot determine file type: ") + magic_error(m));
}
if (!strncmp(ch, "text", 4))
@@ -265,7 +266,7 @@ void CDebugDump::SaveTime()
time_t t = time(NULL);
if (((time_t) -1) == t)
{
- throw std::string("CDebugDump::SaveTime(): Cannot get local time.");
+ throw CABRTException(EXCEP_ERROR, "CDebugDump::SaveTime(): Cannot get local time.");
}
ss << t;
SaveText(FILENAME_TIME, ss.str());
@@ -295,7 +296,7 @@ void CDebugDump::LoadTextFile(const std::string& pPath, std::string& pData)
}
else
{
- throw "CDebugDump: LoadTextFile(): Cannot open file " + pPath;
+ throw CABRTException(EXCEP_DD_LOAD, "CDebugDump: LoadTextFile(): Cannot open file " + pPath);
}
}
@@ -317,7 +318,7 @@ void CDebugDump::LoadBinaryFile(const std::string& pPath, char** pData, unsigned
}
else
{
- throw "CDebugDump: LoadBinaryFile(): Cannot open file " + pPath;
+ throw CABRTException(EXCEP_DD_LOAD, "CDebugDump: LoadBinaryFile(): Cannot open file " + pPath);
}
}
@@ -331,13 +332,13 @@ void CDebugDump::SaveTextFile(const std::string& pPath, const std::string& pData
fOut << pData;
if (!fOut.good())
{
- throw "CDebugDump: SaveTextFile(): Cannot save file " + pPath;
+ throw CABRTException(EXCEP_DD_SAVE, "CDebugDump: SaveTextFile(): Cannot save file " + pPath);
}
fOut.close();
}
else
{
- throw "CDebugDump: SaveTextFile(): Cannot open file " + pPath;
+ throw CABRTException(EXCEP_DD_SAVE, "CDebugDump: SaveTextFile(): Cannot open file " + pPath);
}
}
@@ -350,13 +351,13 @@ void CDebugDump::SaveBinaryFile(const std::string& pPath, const char* pData, con
fOut.write(pData, pSize);
if (!fOut.good())
{
- throw "CDebugDump: SaveBinaryFile(): Cannot save file " + pPath;
+ throw CABRTException(EXCEP_DD_SAVE, "CDebugDump: SaveBinaryFile(): Cannot save file " + pPath);
}
fOut.close();
}
else
{
- throw "CDebugDump: SaveBinaryFile(): Cannot open file " + pPath;
+ throw CABRTException(EXCEP_DD_SAVE, "CDebugDump: SaveBinaryFile(): Cannot open file " + pPath);
}
}
@@ -392,7 +393,7 @@ void CDebugDump::InitGetNextFile()
m_pGetNextFileDir = opendir(m_sDebugDumpDir.c_str());
if (m_pGetNextFileDir == NULL)
{
- throw "CDebugDump::InitGetNextFile(): Cannot open dir " + m_sDebugDumpDir;
+ throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::InitGetNextFile(): Cannot open dir " + m_sDebugDumpDir);
}
}
diff --git a/lib/Utils/DebugDump.h b/lib/Utils/DebugDump.h
index 0539f76e..7dd1dcca 100644
--- a/lib/Utils/DebugDump.h
+++ b/lib/Utils/DebugDump.h
@@ -26,7 +26,6 @@
#include <string>
#include <dirent.h>
-#define FILENAME_UUID "uuid"
#define FILENAME_ARCHITECTURE "architecture"
#define FILENAME_KERNEL "kernel"
#define FILENAME_TIME "time"
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp
index 2884e7c1..390cb107 100644
--- a/src/Daemon/CrashWatcher.cpp
+++ b/src/Daemon/CrashWatcher.cpp
@@ -90,7 +90,7 @@ gboolean CCrashWatcher::handle_event_cb(GIOChannel *gio, GIOCondition condition,
{
if(cc->m_pMW->SaveDebugDump(std::string(DEBUG_DUMPS_DIR) + "/" + name, crashinfo))
{
- cc->m_pMW->Report(std::string(DEBUG_DUMPS_DIR) + "/" + name);
+ cc->m_pMW->Report(crashinfo[CD_MWDDD][CD_CONTENT]);
/* send message to dbus */
cc->m_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT]);
}
@@ -236,7 +236,7 @@ pCommLayerInner = new CCommLayerInner(this);
#endif
m_pCommLayer = new CCommLayerServerDBus();
m_pCommLayer->Attach(this);
-
+
if((m_nFd = inotify_init()) == -1){
throw std::string("Init Failed");
//std::cerr << "Init Failed" << std::endl;