From: Piotr Kosko
Date: Wed, 27 May 2015 10:48:18 +0000 (+0200)
Subject: [Archive] Added logs in methods onEntered and onReturn
X-Git-Tag: submit/tizen_tv/20150603.064601^2~51
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17e4863dbed7ef8acc590f53abcc2d5a73ee4699;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Archive] Added logs in methods onEntered and onReturn
Change-Id: Ibdea02869a83e7e31c9bbf151c84a5b717044a13
Signed-off-by: Piotr Kosko
---
diff --git a/src/archive/archive_callback_data.cc b/src/archive/archive_callback_data.cc
index 32700e4f..bba7ee81 100755
--- a/src/archive/archive_callback_data.cc
+++ b/src/archive/archive_callback_data.cc
@@ -75,6 +75,7 @@ bool OperationCallbackData::isError() const
bool OperationCallbackData::isCanceled() const
{
+ LoggerD("Enter");
return m_is_canceled;
}
@@ -92,30 +93,36 @@ long OperationCallbackData::getOperationId() const
void OperationCallbackData::setCallbackId(double cid)
{
+ LoggerD("Enter");
m_cid = cid;
}
double OperationCallbackData::getCallbackId() const
{
+ LoggerD("Enter");
return m_cid;
}
void OperationCallbackData::setHandle(long handle)
{
+ LoggerD("Enter");
m_handle = handle;
}
long OperationCallbackData::getHandle() const
{
+ LoggerD("Enter");
return m_handle;
}
void OperationCallbackData::setIsCanceled(bool canceled)
{
+ LoggerD("Enter");
m_is_canceled = canceled;
}
void OperationCallbackData::PostMessage(const char* msg) {
+ LoggerD("Enter");
instance_.PostMessage(msg);
}
@@ -139,11 +146,13 @@ ArchiveCallbackType OperationCallbackData::getCallbackType() const
ArchiveFilePtr OperationCallbackData::getArchiveFile() const
{
+ LoggerD("Enter");
return m_caller_instance;
}
void OperationCallbackData::setArchiveFile(ArchiveFilePtr caller)
{
+ LoggerD("Enter");
m_caller_instance = caller;
}
@@ -180,6 +189,7 @@ PlatformResult OpenCallbackData::executeOperation(ArchiveFilePtr archive_file_pt
unsigned long long size = 0;
PlatformResult result = node->getSize(&size);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail node->getSize()");
return result;
}
if (0 == size) {
@@ -208,6 +218,7 @@ PlatformResult OpenCallbackData::executeOperation(ArchiveFilePtr archive_file_pt
archive_file_ptr->setIsOpen(true);
result = archive_file_ptr->updateListOfEntries();
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail archive_file_ptr->updateListOfEntries()");
return result;
}
}
@@ -237,11 +248,13 @@ GetEntriesCallbackData::~GetEntriesCallbackData()
ArchiveFileEntryPtrMapPtr GetEntriesCallbackData::getEntries() const
{
+ LoggerD("Entered");
return m_entries;
}
void GetEntriesCallbackData::setEntries(ArchiveFileEntryPtrMapPtr entries)
{
+ LoggerD("Entered");
m_entries = entries;
}
@@ -288,11 +301,13 @@ void GetEntryByNameCallbackData::setName(const std::string& name)
ArchiveFileEntryPtr GetEntryByNameCallbackData::getFileEntry() const
{
+ LoggerD("Entered");
return m_file_entry;
}
void GetEntryByNameCallbackData::setFileEntry(ArchiveFileEntryPtr entry)
{
+ LoggerD("Entered");
m_file_entry = entry;
}
@@ -371,6 +386,8 @@ struct ProgressHolder
void BaseProgressCallback::callSuccessCallbackOnMainThread()
{
+ LoggerD("Entered");
+
guint id = g_idle_add(BaseProgressCallback::callSuccessCallbackCB,
static_cast(this));
if (!id) {
@@ -380,6 +397,8 @@ void BaseProgressCallback::callSuccessCallbackOnMainThread()
gboolean BaseProgressCallback::callSuccessCallbackCB(void* data)
{
+ LoggerD("Entered");
+
BaseProgressCallback* callback = static_cast(data);
if (!callback) {
LoggerE("callback pointer is NULL");
@@ -436,6 +455,8 @@ void BaseProgressCallback::callProgressCallback(long operationId,
void BaseProgressCallback::callProgressCallbackOnMainThread(const double progress,
ArchiveFileEntryPtr current_entry)
{
+ LoggerD("Entered");
+
ProgressHolder* ph = new(std::nothrow) ProgressHolder();
if(ph) {
@@ -457,6 +478,8 @@ void BaseProgressCallback::callProgressCallbackOnMainThread(const double progres
gboolean BaseProgressCallback::callProgressCallbackCB(void* data)
{
+ LoggerD("Entered");
+
ProgressHolder* ph = static_cast(data);
if (!ph) {
LoggerE("ph is null");
@@ -554,11 +577,13 @@ PlatformResult AddProgressCallback::executeOperation(ArchiveFilePtr archive_file
ZipPtr zip;
PlatformResult result = archive_file_ptr->createZipObject(&zip);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("archive_file_ptr->createZipObject()");
return result;
}
result = zip->addFile(callback);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("zip->addFile()");
return result;
}
@@ -566,6 +591,7 @@ PlatformResult AddProgressCallback::executeOperation(ArchiveFilePtr archive_file
// it is needed to read entries from file
result = zip->close();
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("zip->close()");
return result;
}
@@ -606,28 +632,36 @@ ExtractAllProgressCallback::~ExtractAllProgressCallback()
filesystem::FilePtr ExtractAllProgressCallback::getDirectory() const
{
+ LoggerD("Entered");
return m_directory;
}
void ExtractAllProgressCallback::setDirectory(filesystem::FilePtr directory)
{
+ LoggerD("Entered");
m_directory = directory;
}
void ExtractAllProgressCallback::startedExtractingFile(unsigned long current_file_size)
{
+ LoggerD("Entered");
+
m_current_file_size = current_file_size;
m_current_file_extracted_bytes = 0;
}
void ExtractAllProgressCallback::extractedPartOfFile(unsigned long bytes_decompressed)
{
+ LoggerD("Entered");
+
m_current_file_extracted_bytes += bytes_decompressed;
updateOverallProgress(bytes_decompressed);
}
void ExtractAllProgressCallback::finishedExtractingFile()
{
+ LoggerD("Entered");
+
m_current_file_size = 0;
m_current_file_extracted_bytes = 0;
++m_files_extracted;
@@ -636,6 +670,8 @@ void ExtractAllProgressCallback::finishedExtractingFile()
void ExtractAllProgressCallback::updateOverallProgress(unsigned long bytes_decompressed)
{
+ LoggerD("Entered");
+
m_overall_decompressed += bytes_decompressed;
m_progress_overall =
static_cast(m_overall_decompressed + m_files_extracted) /
@@ -650,6 +686,8 @@ void ExtractAllProgressCallback::updateOverallProgress(unsigned long bytes_decom
double ExtractAllProgressCallback::getCurrentFileProgress() const
{
+ LoggerD("Entered");
+
if(m_current_file_size > 0) {
return static_cast(m_current_file_extracted_bytes) /
static_cast(m_current_file_size);
@@ -661,6 +699,8 @@ double ExtractAllProgressCallback::getCurrentFileProgress() const
double ExtractAllProgressCallback::getOverallProgress() const
{
+ LoggerD("Entered");
+
return m_progress_overall;
}
@@ -672,21 +712,29 @@ PlatformResult ExtractAllProgressCallback::executeOperation(ArchiveFilePtr archi
void ExtractAllProgressCallback::setExpectedDecompressedSize(unsigned long exp_dec_size)
{
+ LoggerD("Entered");
+
m_expected_decompressed_size = exp_dec_size;
}
unsigned long ExtractAllProgressCallback::getExpectedDecompressedSize() const
{
+ LoggerD("Entered");
+
return m_expected_decompressed_size;
}
void ExtractAllProgressCallback::setNumberOfFilesToExtract(unsigned long files_count)
{
+ LoggerD("Entered");
+
m_files_to_extract = files_count;
}
unsigned long ExtractAllProgressCallback::getNumberOfFilesToExtract() const
{
+ LoggerD("Entered");
+
return m_files_to_extract;
}
@@ -720,32 +768,38 @@ ExtractEntryProgressCallback::~ExtractEntryProgressCallback()
ArchiveFileEntryPtr ExtractEntryProgressCallback::getArchiveFileEntry()
{
+ LoggerD("Entered");
return m_archive_file_entry;
}
void ExtractEntryProgressCallback::setArchiveFileEntry(ArchiveFileEntryPtr afentry)
{
+ LoggerD("Entered");
m_archive_file_entry = afentry;
}
void ExtractEntryProgressCallback::setStripName(bool strip_name)
{
+ LoggerD("Entered");
m_strip_name = strip_name;
}
bool ExtractEntryProgressCallback::getStripName() const
{
+ LoggerD("Entered");
return m_strip_name;
}
void ExtractEntryProgressCallback::setStripBasePath(
const std::string& strip_base_path)
{
+ LoggerD("Entered");
m_strip_base_path = strip_base_path;
}
const std::string& ExtractEntryProgressCallback::getStripBasePath() const
{
+ LoggerD("Entered");
return m_strip_base_path;
}
@@ -766,6 +820,7 @@ PlatformResult ExtractEntryProgressCallback::executeOperation(ArchiveFilePtr arc
UnZipPtr unzip;
PlatformResult result = archive_file_ptr->createUnZipObject(&unzip);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("archive_file_ptr->createUnZipObject()");
return result;
}
diff --git a/src/archive/archive_extension.cc b/src/archive/archive_extension.cc
index 9ba3afdf..d0c2b9d5 100755
--- a/src/archive/archive_extension.cc
+++ b/src/archive/archive_extension.cc
@@ -17,26 +17,31 @@
#include "archive_extension.h"
#include "archive_instance.h"
+#include "common/logger.h"
// This will be generated from archive_api.js
extern const char kSource_archive_api[];
common::Extension* CreateExtension()
{
+ LoggerD("Enter");
return new ArchiveExtension;
}
ArchiveExtension::ArchiveExtension()
{
+ LoggerD("Enter");
SetExtensionName("tizen.archive");
SetJavaScriptAPI(kSource_archive_api);
}
ArchiveExtension::~ArchiveExtension()
{
+ LoggerD("Enter");
}
common::Instance* ArchiveExtension::CreateInstance()
{
+ LoggerD("Enter");
return new extension::archive::ArchiveInstance();
}
diff --git a/src/archive/archive_file.cc b/src/archive/archive_file.cc
index dc0ba0f5..cb568417 100755
--- a/src/archive/archive_file.cc
+++ b/src/archive/archive_file.cc
@@ -32,6 +32,7 @@ namespace extension {
namespace archive {
Permission::Permission(bool r, bool w, bool rw, bool a){
+ LoggerD("Enter");
permission[0] = r;
permission[1] = w;
permission[2] = rw;
@@ -65,6 +66,7 @@ ArchiveFile::ArchiveFile(FileMode file_mode) :
m_is_open(false),
m_overwrite(false)
{
+ LoggerD("Enter");
m_file_mode = file_mode;
}
@@ -269,6 +271,7 @@ PlatformResult ArchiveFile::addOperation(OperationCallbackData* callback)
PlatformResult ArchiveFile::extractAllTask(ExtractAllProgressCallback* callback)
{
+ LoggerD("Enter");
filesystem::FilePtr directory = callback->getDirectory();
if(!directory) {
@@ -297,6 +300,7 @@ PlatformResult ArchiveFile::extractAllTask(ExtractAllProgressCallback* callback)
unsigned long long size = 0;
PlatformResult result = m_file->getNode()->getSize(&size);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail m_file->getNode()->getSize()");
return result;
}
if(size == 0) {
@@ -319,6 +323,7 @@ PlatformResult ArchiveFile::extractAllTask(ExtractAllProgressCallback* callback)
UnZipPtr unzip;
result = createUnZipObject(&unzip);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail createUnZipObject()");
return result;
}
@@ -580,6 +585,7 @@ void ArchiveFile::setIsOpen(bool is_open)
ArchiveFileEntryPtrMapPtr ArchiveFile::getEntryMap() const
{
+ LoggerD("Entered");
return m_entry_map;
}
@@ -675,16 +681,19 @@ void ArchiveFile::setFileMode(FileMode file_mode)
void ArchiveFile::setCreatedAsNewEmptyArchive(bool new_and_empty)
{
+ LoggerD("Entered");
m_created_as_new_empty_archive = new_and_empty;
}
bool ArchiveFile::isCreatedAsNewEmptyArchive() const
{
+ LoggerD("Entered");
return m_created_as_new_empty_archive;
}
PlatformResult ArchiveFile::updateListOfEntries()
{
+ LoggerD("Entered");
// For explanation please see:
// ArchiveFile.h m_created_as_new_empty_archive description
//
@@ -712,6 +721,7 @@ PlatformResult ArchiveFile::updateListOfEntries()
UnZipPtr unzip;
result = createUnZipObject(&unzip);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerD("Fail createUnZipObject()");
return result;
}
@@ -719,6 +729,7 @@ PlatformResult ArchiveFile::updateListOfEntries()
ArchiveFileEntryPtrMapPtr emap;
result = unzip->listEntries(&decompressedSize, &emap);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerD("Fail unzip->listEntries()");
return result;
}
@@ -731,6 +742,8 @@ bool ArchiveFile::isEntryWithNameInArchive(const std::string& name_in_zip,
bool* out_is_directory,
std::string* out_matching_name)
{
+ LoggerD("Enter");
+
if(!m_entry_map) {
LoggerW("m_entry_map is NULL");
return false;
@@ -763,6 +776,7 @@ bool ArchiveFile::isEntryWithNameInArchive(const std::string& name_in_zip,
}
if(!set_name_exists) {
+ LoggerE("Fail: name do not exists");
return false;
}
diff --git a/src/archive/archive_instance.cc b/src/archive/archive_instance.cc
index 56fa884b..789b18a8 100755
--- a/src/archive/archive_instance.cc
+++ b/src/archive/archive_instance.cc
@@ -239,6 +239,8 @@ void ArchiveInstance::Abort(const picojson::value& args, picojson::object& out)
}
unsigned int ConvertStringToCompressionLevel(const std::string& level) {
+ LoggerD("Entered");
+
if (kNoCompressionStr == level) {
return Z_NO_COMPRESSION;
} else if (kFastCompressionStr == level) {
@@ -585,6 +587,8 @@ void ArchiveInstance::Extract(const picojson::value& args, picojson::object& out
}
void ArchiveInstance::GetWidgetPaths(const picojson::value& args, picojson::object& out) {
+ LoggerD("Entered");
+
std::string wgt_package_path =
*(common::VirtualFs::GetInstance().GetVirtualRootDirectory(kWgtPackagePathName));
std::string wgt_private_path =
diff --git a/src/archive/archive_manager.cc b/src/archive/archive_manager.cc
index 95d8348f..e60db683 100755
--- a/src/archive/archive_manager.cc
+++ b/src/archive/archive_manager.cc
@@ -88,6 +88,7 @@ PlatformResult ArchiveManager::getPrivData(long handle, ArchiveFilePtr* archive_
*archive_file = it->second;
return PlatformResult(ErrorCode::NO_ERROR);
}
+ LoggerE("Failed: Priv is null");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Priv is null");
}
diff --git a/src/archive/archive_utils.cc b/src/archive/archive_utils.cc
index a678413d..c88a4b24 100755
--- a/src/archive/archive_utils.cc
+++ b/src/archive/archive_utils.cc
@@ -31,6 +31,7 @@ using namespace filesystem;
std::string bytesToReadableString(const size_t num_bytes)
{
+ LoggerD("Enter");
std::stringstream ss;
static const size_t one_mb = 1024 * 1024;
static const size_t one_kb = 1024;
@@ -49,6 +50,7 @@ std::string bytesToReadableString(const size_t num_bytes)
PlatformResult fileModeToString(FileMode fm, std::string* fm_str)
{
+ LoggerD("Enter");
switch(fm) {
case FileMode::READ:
*fm_str = "r";
@@ -63,6 +65,7 @@ PlatformResult fileModeToString(FileMode fm, std::string* fm_str)
*fm_str = "a";
break;
default:
+ LoggerE("Unknown file mode");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown file mode");
}
return PlatformResult(ErrorCode::NO_ERROR);
@@ -70,6 +73,7 @@ PlatformResult fileModeToString(FileMode fm, std::string* fm_str)
PlatformResult stringToFileMode(std::string fmString, FileMode* fm)
{
+ LoggerD("Enter");
if (!fmString.compare("r")) {
*fm = FileMode::READ;
return PlatformResult(ErrorCode::NO_ERROR);
@@ -88,13 +92,14 @@ PlatformResult stringToFileMode(std::string fmString, FileMode* fm)
}
// In widl it's "TypeMismatchError" so this exception used
// instead of InvalidValues
+ LoggerE("Invalid FileMode");
return PlatformResult(ErrorCode::TYPE_MISMATCH_ERR, "Invalid FileMode");
}
// FilePtr fileReferenceToFile(JSContextRef context, JSValueRef fileReference)
// {
// auto g_ctx = GlobalContextManager::getInstance()->getGlobalContext(context);
-//
+//
// FilePtr file_ptr;
// try {
// file_ptr = JSFile::getPrivateObject(context, fileReference);
@@ -110,12 +115,12 @@ PlatformResult stringToFileMode(std::string fmString, FileMode* fm)
// std::string string_path =
// External::fromVirtualPath(virtual_path, g_ctx);
// LOGD("Path: %s", string_path.c_str());
-//
+//
// PathPtr path = Path::create(string_path);
// NodePtr node_ptr = Node::resolve(path);
// file_ptr = FilePtr(new File(node_ptr, File::PermissionList()));
// }
-//
+//
// return file_ptr;
// }
@@ -123,6 +128,7 @@ void getBasePathAndName(const std::string& filepath,
std::string& out_basepath,
std::string& out_name)
{
+ LoggerD("Enter");
const size_t filepath_len = filepath.length();
size_t name_end_index = filepath_len;
@@ -151,6 +157,7 @@ void getBasePathAndName(const std::string& filepath,
std::string removeDuplicatedSlashesFromPath(const std::string& path)
{
+ LoggerD("Enter");
const size_t path_len = path.length();
std::string out;
@@ -175,6 +182,7 @@ std::string removeDuplicatedSlashesFromPath(const std::string& path)
bool isDirectoryPath(const std::string& path)
{
+ LoggerD("Enter");
if(path.empty()) {
return false;
}
@@ -185,6 +193,7 @@ bool isDirectoryPath(const std::string& path)
std::string removeTrailingDirectorySlashFromPath(const std::string& path)
{
+ LoggerD("Enter");
if(!isDirectoryPath(path)) {
return path;
}
@@ -194,6 +203,7 @@ std::string removeTrailingDirectorySlashFromPath(const std::string& path)
std::string stripBasePathFromPath(const std::string& fullpath)
{
+ LoggerD("Enter");
const size_t location = fullpath.find_last_of("/\\");
if(std::string::npos == location) {
return fullpath;
@@ -213,6 +223,7 @@ static std::string errUnknown = "Unknown error";
const std::string& getArchiveErrorMessage(int errorCode)
{
+ LoggerD("Enter");
/**
* All errors are defined in minizip library in files:
* zip.h and unzip.h
@@ -244,6 +255,7 @@ const std::string& getArchiveErrorMessage(int errorCode)
std::string getBasePathFromPath(const std::string& fullpath)
{
+ LoggerD("Enter");
const std::string tmp_path = removeTrailingDirectorySlashFromPath(fullpath);
const size_t location = tmp_path.find_last_of("/\\");
if(std::string::npos == location) {
@@ -255,6 +267,7 @@ std::string getBasePathFromPath(const std::string& fullpath)
std::string getArchiveLogMessage(const int errorCode, const std::string &hint)
{
+ LoggerD("Enter");
std::stringstream ss;
ss << "Failed " << hint << " : " << getArchiveErrorMessage(errorCode) << ", " << errorCode;
return std::string(ss.str());
diff --git a/src/archive/filesystem_file.cc b/src/archive/filesystem_file.cc
index 7ec7563d..04e963e9 100755
--- a/src/archive/filesystem_file.cc
+++ b/src/archive/filesystem_file.cc
@@ -32,6 +32,7 @@ File::File(NodePtr node, const File::PermissionList &parentPermissions,
File::~File()
{
+ LoggerD("Enter");
}
NodePtr File::getNode() const
diff --git a/src/archive/filesystem_node.cc b/src/archive/filesystem_node.cc
index ab5fd89e..f76950c1 100755
--- a/src/archive/filesystem_node.cc
+++ b/src/archive/filesystem_node.cc
@@ -39,6 +39,7 @@ using namespace common;
#define MAX_NODE_LENGTH 256
PlatformResult Node::checkPermission(const PathPtr &path, const std::string &mode, NodeType type, bool* granted)
{
+ LoggerD("Enter");
*granted = false;
switch (type)
@@ -48,12 +49,12 @@ PlatformResult Node::checkPermission(const PathPtr &path, const std::string &mod
DIR* dir = opendir(path->getFullPath().c_str());
if (!dir) {
- LoggerW("throw InvalidValuesException");
+ LoggerE("throw InvalidValuesException");
return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Node has been deleted from platform.");
}
if (closedir(dir) != 0) {
- LoggerW("throw InvalidValuesException");
+ LoggerE("throw InvalidValuesException");
return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Could not close platform node.");
}
@@ -83,7 +84,7 @@ PlatformResult Node::checkPermission(const PathPtr &path, const std::string &mod
*granted = true;
return PlatformResult(ErrorCode::NO_ERROR);
}
- LoggerW("throw InvalidValuesException");
+ LoggerE("throw InvalidValuesException");
return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "invalid mode");
}
break;
@@ -102,7 +103,7 @@ PlatformResult Node::checkPermission(const PathPtr &path, const std::string &mod
}
else
{
- LoggerW("throw InvalidValuesException");
+ LoggerE("throw InvalidValuesException");
return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "invalid mode");
}
@@ -133,21 +134,21 @@ PlatformResult Node::resolve(const PathPtr& path, NodePtr* node)
switch (errno)
{
case EACCES:
- LoggerW("throw InvalidValuesException for file:[%s]", path->getFullPath().c_str());
+ LoggerE("throw InvalidValuesException for file:[%s]", path->getFullPath().c_str());
return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Node access denied");
break;
case ENOENT:
- LoggerW("throw NotFoundException for file:[%s]", path->getFullPath().c_str());
+ LoggerE("throw NotFoundException for file:[%s]", path->getFullPath().c_str());
return PlatformResult(ErrorCode::NOT_FOUND_ERR, "NotFoundError");
break;
default:
- LoggerW("throw IOException for file:[%s]", path->getFullPath().c_str());
+ LoggerE("throw IOException for file:[%s]", path->getFullPath().c_str());
return PlatformResult(ErrorCode::IO_ERR, "Platform exception fail");
}
}
if (!S_ISDIR(info.st_mode) & !S_ISREG(info.st_mode) && !S_ISLNK(info.st_mode)) {
- LoggerW("throw IOException for file:[%s]", path->getFullPath().c_str());
+ LoggerE("throw IOException for file:[%s]", path->getFullPath().c_str());
return PlatformResult(ErrorCode::IO_ERR, "Platform node is of unsupported type.");
}
@@ -156,6 +157,7 @@ PlatformResult Node::resolve(const PathPtr& path, NodePtr* node)
if (S_ISLNK(info.st_mode)) {
PlatformResult result = stat(path, &syminfo);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Error: %s", result.message().c_str());
return result;
}
@@ -178,6 +180,7 @@ PathPtr Node::getPath() const
PlatformResult Node::getChild(const PathPtr& path, NodePtr* node)
{
+ LoggerD("Enter");
if (m_type != NT_DIRECTORY) {
LoggerW("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Not a directory.");
@@ -202,19 +205,20 @@ void Node::setPermissions(int perms)
PlatformResult Node::getChildNames(Node::NameList* out_name_list) const
{
+ LoggerD("Enter");
if (m_type != NT_DIRECTORY) {
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Node is not directory.");
}
if ((m_perms & PERM_READ) == 0) {
- LoggerW("throw InvalidValuesException");
+ LoggerE("throw InvalidValuesException");
return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "No permission.");
}
DIR* dir = opendir(m_path->getFullPath().c_str());
if (!dir) {
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Node has been deleted from platform.");
}
@@ -228,12 +232,12 @@ PlatformResult Node::getChildNames(Node::NameList* out_name_list) const
name_list.push_back(entry->d_name);
}
if (errno != 0) {
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Error while reading directory.");
}
if (closedir(dir) != 0) {
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Could not close platform node.");
}
@@ -243,23 +247,25 @@ PlatformResult Node::getChildNames(Node::NameList* out_name_list) const
PlatformResult Node::getChildNodes(NodeList* out_node_list) const
{
+ LoggerD("Enter");
+
if (m_type != NT_DIRECTORY) {
- LoggerW("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
- LoggerW("throw IOException");
- LoggerW("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
+ LoggerE("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
+ LoggerE("throw IOException");
+ LoggerE("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
return PlatformResult(ErrorCode::IO_ERR, "Node is not directory.");
}
if ((m_perms & PERM_READ) == 0) {
- LoggerW("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
- LoggerW("throw InvalidValuesException");
+ LoggerE("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
+ LoggerE("throw InvalidValuesException");
return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "No permission.");
}
DIR* dir = opendir(m_path->getFullPath().c_str());
if (!dir) {
- LoggerW("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
- LoggerW("throw IOException");
+ LoggerE("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Node has been deleted from platform.");
}
@@ -278,14 +284,14 @@ PlatformResult Node::getChildNodes(NodeList* out_node_list) const
}
if (errno != 0) {
- LoggerW("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
- LoggerW("throw IOException");
+ LoggerE("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Error while reading directory.");
}
if (closedir(dir) != 0) {
- LoggerW("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
- LoggerW("throw IOException");
+ LoggerE("Path %s Perm %d", m_path->getFullPath().c_str(), m_perms);
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Could not close platform node.");
}
@@ -300,13 +306,14 @@ PlatformResult Node::createChild(
NodePtr* node,
int options)
{
+ LoggerD("Enter");
if (m_type != NT_DIRECTORY) {
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Parent node is not a directory.");
}
if ((m_perms & PERM_WRITE) == 0) {
- LoggerW("throw InvalidValuesException");
+ LoggerE("throw InvalidValuesException");
return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Not enough permissions.");
}
@@ -314,10 +321,11 @@ PlatformResult Node::createChild(
bool existed;
PlatformResult result = exists(childPath, &existed);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail: exists()");
return result;
}
if (existed) {
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Node already exists.");
}
@@ -329,17 +337,18 @@ PlatformResult Node::createChild(
result = createAsDirectory(childPath, node, options);
break;
default:
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Unsupported node type.");
}
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail CreateAs...()");
return result;
}
if (!!(*node)) {
(*node)->m_perms = m_perms;
} else {
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Node creation error");
}
@@ -348,6 +357,7 @@ PlatformResult Node::createChild(
PlatformResult Node::remove(int options)
{
+ LoggerD("Enter");
PlatformResult result(ErrorCode::NO_ERROR);
switch (m_type) {
case NT_FILE:
@@ -365,21 +375,23 @@ PlatformResult Node::remove(int options)
PlatformResult Node::getSize(unsigned long long* size) const
{
+ LoggerD("Enter");
if (m_type == NT_DIRECTORY) {
- LoggerW("Getting size for directories is not supported.");
- LoggerW("throw IOException");
+ LoggerE("Getting size for directories is not supported.");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Getting size for directories is not supported.");
}
struct stat info;
PlatformResult result = stat(m_path, &info);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail: stat()");
return result;
}
if (!S_ISREG(info.st_mode)) {
- LoggerW("Specified node is not a regular file.");
- LoggerW("throw IOException");
+ LoggerE("Specified node is not a regular file.");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Specified node is not a regular file.");
}
@@ -390,9 +402,11 @@ PlatformResult Node::getSize(unsigned long long* size) const
PlatformResult Node::getCreated(std::time_t* time) const
{
+ LoggerD("Enter");
struct stat info;
PlatformResult result = stat(m_path, &info);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail: stat()");
return result;
}
*time = info.st_ctime;
@@ -401,9 +415,11 @@ PlatformResult Node::getCreated(std::time_t* time) const
PlatformResult Node::getModified(std::time_t* time) const
{
+ LoggerD("Enter");
struct stat info;
PlatformResult result = stat(m_path, &info);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail: stat()");
return result;
}
*time = info.st_mtime;
@@ -413,6 +429,8 @@ PlatformResult Node::getModified(std::time_t* time) const
// TODO Optimize it, maybe store a flag indicating that node is a root.
PlatformResult Node::getParent(NodePtr* node) const
{
+ LoggerD("Enter");
+
// LocationPaths roots = Manager::getInstance().getLocationPaths();
// for (LocationPaths::iterator it = roots.begin(); it != roots.end(); ++it) {
// if (*(*it) == *m_path) {
@@ -429,6 +447,8 @@ PlatformResult Node::getParent(NodePtr* node) const
PlatformResult Node::getMode(int* mode) const
{
+ LoggerD("Enter");
+
struct stat info;
PlatformResult result = stat(m_path, &info);
if (result.error_code() == ErrorCode::NO_ERROR) {
@@ -448,6 +468,8 @@ PlatformResult Node::getMode(int* mode) const
PlatformResult Node::exists(const PathPtr& path, bool* existed)
{
+ LoggerD("Enter");
+
struct stat info;
memset(&info, 0, sizeof(struct stat));
int status = lstat(path->getFullPath().c_str(), &info);
@@ -461,7 +483,7 @@ PlatformResult Node::exists(const PathPtr& path, bool* existed)
}
else if (ENAMETOOLONG == errno)
{
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "file name is too long");
}
else if (errno != ENOENT)
@@ -474,13 +496,14 @@ PlatformResult Node::exists(const PathPtr& path, bool* existed)
PlatformResult Node::stat(const PathPtr& path, struct stat* out_info)
{
+ LoggerD("Enter");
struct stat info;
memset(&info, 0, sizeof(struct stat));
if (::stat(path->getFullPath().c_str(), &info) != 0)
{
LoggerE("File: %s", path->getFullPath().c_str());
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Node does not exist or no access");
}
*out_info = info;
@@ -492,10 +515,13 @@ Node::Node(const PathPtr& path, NodeType type):
m_type(type),
m_perms(PERM_NONE)
{
+ LoggerD("Enter");
}
PlatformResult Node::createAsFile(const PathPtr& path, NodePtr* node, int /* options */)
{
+ LoggerD("Enter");
+
PlatformResult result = createAsFileInternal(path);
if (result.error_code() == ErrorCode::NO_ERROR) {
node->reset(new Node(path, NT_FILE));
@@ -505,9 +531,11 @@ PlatformResult Node::createAsFile(const PathPtr& path, NodePtr* node, int /* opt
PlatformResult Node::createAsFileInternal(const PathPtr& path)
{
+ LoggerD("Enter");
+
FILE* file = std::fopen(path->getFullPath().c_str(), "wb");
if (!file) {
- LoggerW("fopen fails IOException throw for path [%s]",
+ LoggerE("fopen fails IOException throw for path [%s]",
path->getFullPath().c_str());
return PlatformResult(ErrorCode::IO_ERR, "Platform node could not be created.");
}
@@ -517,6 +545,8 @@ PlatformResult Node::createAsFileInternal(const PathPtr& path)
PlatformResult Node::createAsDirectory(const PathPtr& path, NodePtr* node, int options)
{
+ LoggerD("Enter");
+
// if (options & OPT_RECURSIVE) {
// auto parts = Utils::getParts(path);
// for (auto it = parts.begin(); it != parts.end(); ++it) {
@@ -532,9 +562,11 @@ PlatformResult Node::createAsDirectory(const PathPtr& path, NodePtr* node, int o
PlatformResult Node::createAsDirectoryInternal(const PathPtr& path)
{
+ LoggerD("Enter");
+
if (mkdir(path->getFullPath().c_str(), S_IRWXU | S_IRWXG | S_IROTH |
S_IXOTH) != 0) {
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Platform node could not be created.");
}
return PlatformResult(ErrorCode::NO_ERROR);
@@ -542,10 +574,12 @@ PlatformResult Node::createAsDirectoryInternal(const PathPtr& path)
PlatformResult Node::removeAsFile(const PathPtr& path)
{
+ LoggerD("Enter");
+
auto fullPath = path->getFullPath();
if (unlink(fullPath.c_str()) != 0) {
- LoggerW("remove [%s]", fullPath.c_str());
- LoggerW("throw IOException");
+ LoggerE("remove [%s]", fullPath.c_str());
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Error while removing platform node.");
}
return PlatformResult(ErrorCode::NO_ERROR);
@@ -553,11 +587,13 @@ PlatformResult Node::removeAsFile(const PathPtr& path)
PlatformResult Node::removeAsDirectory(const PathPtr& path, bool recursive)
{
+ LoggerD("Enter");
+
if (recursive) {
DIR* dir = opendir(path->getFullPath().c_str());
if (!dir) {
- LoggerW("File %s", path->getFullPath().c_str());
- LoggerW("throw IOException");
+ LoggerE("File %s", path->getFullPath().c_str());
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Node does not exist or access denied.");
}
errno = 0;
@@ -577,6 +613,7 @@ PlatformResult Node::removeAsDirectory(const PathPtr& path, bool recursive)
result = removeAsFile(subPath);
}
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail: getFullPath() (%d)",result.error_code());
return result;
}
}
@@ -587,10 +624,10 @@ PlatformResult Node::removeAsDirectory(const PathPtr& path, bool recursive)
errno = 0;
if (rmdir(path->getFullPath().c_str()) != 0) {
if (errno == EEXIST) {
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Node has child nodes.");
}
- LoggerW("throw IOException");
+ LoggerE("throw IOException");
return PlatformResult(ErrorCode::IO_ERR, "Error while removing platform node.");
}
@@ -599,12 +636,14 @@ PlatformResult Node::removeAsDirectory(const PathPtr& path, bool recursive)
std::string Node::toUri(int /*widgetId*/) const
{
+ LoggerD("Enter");
// TODO I believe moving this feature to WrtWrapper would make more sense.
return "file://" + m_path->getFullPath();
}
bool Node::isSubPath(std::string aDirPath, PathPtr aFilePath)
{
+ LoggerD("Enter");
auto myPath = aDirPath;
if(!myPath.empty() && myPath[myPath.length()-1] != Path::getSeparator()) {
myPath += Path::getSeparator();
diff --git a/src/archive/filesystem_path.cc b/src/archive/filesystem_path.cc
index e5973ab4..1357a711 100755
--- a/src/archive/filesystem_path.cc
+++ b/src/archive/filesystem_path.cc
@@ -30,6 +30,7 @@ const Path::SeparatorType Path::m_pathSeparator = '/';
PathPtr Path::create(const std::string& path)
{
+ LoggerD("Enter");
auto result = std::shared_ptr(new Path());
result->reset(path);
return result;
@@ -88,11 +89,12 @@ Path::Path()
void Path::reset(const std::string& str)
{
+ LoggerD("Enter");
if (!isValid(str)) {
LoggerD("Invalid string %s", str.c_str());
LoggerW("throw NotFoundException");
// The only way to remove throw statement from here is to just return, because
- // this function is used in the operator functions and they're not able
+ // this function is used in the operator functions and they're not able
// to handle a PlatformResult value;
return;
}
diff --git a/src/archive/un_zip.cc b/src/archive/un_zip.cc
index bc46f2da..51724c22 100755
--- a/src/archive/un_zip.cc
+++ b/src/archive/un_zip.cc
@@ -43,12 +43,12 @@ UnZip::UnZip(const std::string& filename) :
m_default_buffer_size(1024 * 1024)
{
LoggerD("Entered");
-
m_unzip = unzOpen(filename.c_str());
}
UnZip::~UnZip()
{
+ LoggerD("Enter");
close();
}
@@ -87,6 +87,7 @@ PlatformResult UnZip::open(const std::string& filename, UnZipPtr* out_unzip)
PlatformResult UnZip::listEntries(unsigned long *decompressedSize, ArchiveFileEntryPtrMapPtr* out_map)
{
+ LoggerD("Enter");
if(!m_is_open) {
LoggerE("Failed to get list of entries - UnZip closed");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get list of files in zip archive");
@@ -164,6 +165,7 @@ PlatformResult UnZip::listEntries(unsigned long *decompressedSize, ArchiveFileEn
PlatformResult UnZip::extractAllFilesTo(const std::string& extract_path,
ExtractAllProgressCallback* callback)
{
+ LoggerD("Enter");
if(!m_is_open) {
LoggerE("Failed to extract files - UnZip closed");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to extract zip archive");
@@ -175,6 +177,7 @@ PlatformResult UnZip::extractAllFilesTo(const std::string& extract_path,
unz_global_info gi;
PlatformResult result = updateCallbackWithArchiveStatistics(callback, gi);
if ( result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Error: %s", result.message().c_str());
return result;
}
@@ -183,7 +186,7 @@ PlatformResult UnZip::extractAllFilesTo(const std::string& extract_path,
//
int err = unzGoToFirstFile(m_unzip);
if (err != UNZ_OK) {
- LoggerW("%s",getArchiveLogMessage(err, "unzGoToFirstFile()").c_str());
+ LoggerE("%s",getArchiveLogMessage(err, "unzGoToFirstFile()").c_str());
}
for (uLong i = 0; i < gi.number_entry; i++) {
@@ -195,6 +198,7 @@ PlatformResult UnZip::extractAllFilesTo(const std::string& extract_path,
result = extractCurrentFile(extract_path, std::string(), callback);
if ( result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail: extractCurrentFile()");
return result;
}
@@ -222,6 +226,7 @@ struct ExtractDataHolder
PlatformResult UnZip::extractTo(ExtractEntryProgressCallback* callback)
{
+ LoggerD("Enter");
if(!m_is_open) {
LoggerE("Extract archive file entry failed - UnZip closed");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Extract archive file entry failed");
@@ -269,6 +274,7 @@ PlatformResult UnZip::extractTo(ExtractEntryProgressCallback* callback)
unz_global_info gi;
PlatformResult result = updateCallbackWithArchiveStatistics(callback, gi, entry_name_in_zip);
if ( result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail: updateCallbackWithArchiveStatistics()");
return result;
}
@@ -285,6 +291,7 @@ PlatformResult UnZip::extractTo(ExtractEntryProgressCallback* callback)
unsigned int matched;
result = IterateFilesInZip(gi, entry_name_in_zip, callback, extractItFunction, matched, &h);
if ( result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Fail: IterateFilesInZip()");
return result;
}
@@ -298,6 +305,7 @@ PlatformResult UnZip::extractTo(ExtractEntryProgressCallback* callback)
PlatformResult UnZip::extractItFunction(const std::string& file_name, unz_file_info& file_info,
void* user_data)
{
+ LoggerD("Enter");
ExtractDataHolder* h = static_cast(user_data);
if(!h) {
LoggerE("ExtractDataHolder is NULL!");
@@ -308,6 +316,7 @@ PlatformResult UnZip::extractItFunction(const std::string& file_name, unz_file_i
h->callback->getStripBasePath(),
h->callback);
if ( result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Error: %s", result.message().c_str());
return result;
}
@@ -321,6 +330,7 @@ PlatformResult UnZip::IterateFilesInZip(unz_global_info& gi,
unsigned int& num_file_or_folder_matched,
void* user_data)
{
+ LoggerD("Enter");
int err = unzGoToFirstFile(m_unzip);
if (UNZ_OK != err) {
LoggerW("%s",getArchiveLogMessage(err, "unzGoToFirstFile()").c_str());
@@ -363,6 +373,7 @@ PlatformResult UnZip::IterateFilesInZip(unz_global_info& gi,
if(match) {
PlatformResult result = itfunc(cur_filename_in_zip, cur_file_info, user_data);
if ( result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Error: %s", result.message().c_str());
return result;
}
++num_file_or_folder_matched;
@@ -410,6 +421,7 @@ struct ArchiveStatistics
PlatformResult generateArchiveStatistics(const std::string& file_name, unz_file_info& file_info,
void* user_data)
{
+ LoggerD("Enter");
if(user_data) {
ArchiveStatistics* astats = static_cast(user_data);
astats->uncompressed_size += file_info.uncompressed_size;
@@ -428,6 +440,7 @@ PlatformResult UnZip::updateCallbackWithArchiveStatistics(ExtractAllProgressCall
unz_global_info& out_global_info,
const std::string optional_filter)
{
+ LoggerD("Enter");
int err = unzGetGlobalInfo(m_unzip, &out_global_info);
if (UNZ_OK != err) {
LoggerE("ret: %d",err);
@@ -440,6 +453,7 @@ PlatformResult UnZip::updateCallbackWithArchiveStatistics(ExtractAllProgressCall
PlatformResult result = IterateFilesInZip(out_global_info, optional_filter,
callback, generateArchiveStatistics, num_matched, &astats);
if ( result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Error: %s", result.message().c_str());
return result;
}
if(0 == num_matched) {
diff --git a/src/archive/un_zip.h b/src/archive/un_zip.h
index 7453b526..30dc9e3a 100755
--- a/src/archive/un_zip.h
+++ b/src/archive/un_zip.h
@@ -78,7 +78,7 @@ private:
const std::string& entry_name_in_zip,
OperationCallbackData* callback,
IterateFunction itfunc,
- unsigned int& num_file_or_folder_matched,
+ unsigned int& num_file_or_folder_matched,
void* user_data);
PlatformResult updateCallbackWithArchiveStatistics(ExtractAllProgressCallback* callback,
diff --git a/src/archive/un_zip_extract_request.cc b/src/archive/un_zip_extract_request.cc
index af58f950..fd96a319 100755
--- a/src/archive/un_zip_extract_request.cc
+++ b/src/archive/un_zip_extract_request.cc
@@ -38,6 +38,7 @@ using namespace common;
FilePathStatus getPathStatus(const std::string& path)
{
+ LoggerD("Enter");
if(path.empty()) {
return FPS_NOT_EXIST;
}
@@ -58,6 +59,7 @@ FilePathStatus getPathStatus(const std::string& path)
void divideToPathAndName(const std::string& filepath, std::string& out_path,
std::string& out_name)
{
+ LoggerD("Enter");
size_t pos_last_dir = filepath.find_last_of("/\\");
if(pos_last_dir == std::string::npos) {
out_path = "";
@@ -70,6 +72,7 @@ void divideToPathAndName(const std::string& filepath, std::string& out_path,
void createMissingDirectories(const std::string& path, bool check_first = true)
{
+ LoggerD("Enter");
if(check_first) {
const FilePathStatus path_status = getPathStatus(path);
//LoggerD("[%s] status: %d", path.c_str(), path_status);
@@ -104,6 +107,7 @@ void createMissingDirectories(const std::string& path, bool check_first = true)
void changeFileAccessAndModifyDate(const std::string& filepath, tm_unz tmu_date)
{
+ LoggerD("Enter");
struct utimbuf ut;
struct tm newdate;
newdate.tm_sec = tmu_date.tm_sec;
@@ -129,6 +133,7 @@ PlatformResult UnZipExtractRequest::execute(UnZip& owner, const std::string& ext
const std::string& base_strip_path,
BaseProgressCallback* callback)
{
+ LoggerD("Enter");
UnZipExtractRequest req(owner, extract_path, base_strip_path, callback);
if(!req.m_callback){
LoggerE("Callback is null");
@@ -155,6 +160,7 @@ UnZipExtractRequest::UnZipExtractRequest(UnZip& owner,
m_is_directory_entry(false)
{
+ LoggerD("Enter");
}
PlatformResult UnZipExtractRequest::run()
@@ -163,6 +169,7 @@ PlatformResult UnZipExtractRequest::run()
PlatformResult result = getCurrentFileInfo();
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Error: %s", result.message().c_str());
return result;
}
@@ -177,6 +184,8 @@ PlatformResult UnZipExtractRequest::run()
UnZipExtractRequest::~UnZipExtractRequest()
{
+ LoggerD("Enter");
+
if(m_output_file) {
fclose(m_output_file);
m_output_file = NULL;
@@ -359,10 +368,12 @@ PlatformResult UnZipExtractRequest::prepareOutputSubdirectory()
filesystem::NodePtr node;
PlatformResult result = filesystem::Node::resolve(path, &node);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Error: %s", result.message().c_str());
return result;
}
result = node->remove(filesystem::OPT_RECURSIVE);
if (result.error_code() != ErrorCode::NO_ERROR) {
+ LoggerE("Error: %s", result.message().c_str());
return result;
}
}
diff --git a/src/archive/zip.cc b/src/archive/zip.cc
index 196aec19..51d4a926 100755
--- a/src/archive/zip.cc
+++ b/src/archive/zip.cc
@@ -37,6 +37,8 @@ using namespace common;
void Zip::generateZipFileInfo(const std::string& filename, zip_fileinfo& out_zi)
{
+ LoggerD("Enter");
+
memset(&out_zi, 0, sizeof(zip_fileinfo));
time_t tm_t = 0;
@@ -84,6 +86,8 @@ Zip::Zip(const std::string& filename, ZipOpenMode open_mode) :
Zip::~Zip()
{
+ LoggerD("Enter");
+
close();
}
diff --git a/src/archive/zip_add_request.cc b/src/archive/zip_add_request.cc
index 1712953c..ba7b5efd 100755
--- a/src/archive/zip_add_request.cc
+++ b/src/archive/zip_add_request.cc
@@ -38,10 +38,13 @@ ZipAddRequest::ZipAddRequest(Zip& owner, AddProgressCallback*& callback) :
m_compression_level(0),
m_new_file_in_zip_opened(false)
{
+ LoggerD("Enter");
+
}
ZipAddRequest::~ZipAddRequest()
{
+ LoggerD("Enter");
if(m_input_file) {
fclose(m_input_file);
m_input_file = NULL;
@@ -61,12 +64,14 @@ ZipAddRequest::~ZipAddRequest()
PlatformResult ZipAddRequest::execute(Zip& owner, AddProgressCallback*& callback)
{
+ LoggerD("Enter");
ZipAddRequest req(owner, callback);
return req.run();
}
PlatformResult ZipAddRequest::run()
{
+ LoggerD("Enter");
if(!m_callback) {
LoggerE("m_callback is NULL");
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Could not add file(-s) to archive");
@@ -185,6 +190,7 @@ PlatformResult ZipAddRequest::run()
void ZipAddRequest::addNodeAndSubdirsToList(filesystem::NodePtr src_node,
filesystem::NodeList& out_list_of_child_nodes)
{
+ LoggerD("Enter");
out_list_of_child_nodes.push_back(src_node);
if(filesystem::NT_DIRECTORY == src_node->getType()) {
@@ -285,6 +291,7 @@ PlatformResult ZipAddRequest::addEmptyDirectoryToZipArchive(std::string name_in_
PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node)
{
+ LoggerD("Enter");
const std::string name_in_zip = getNameInZipArchiveFor(src_file_node,
m_callback->getFileEntry()->getStriped());
const std::string src_file_path = src_file_node->getPath()->getFullPath();
@@ -465,6 +472,7 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node)
std::string removeDirCharsFromFront(const std::string& path)
{
+ LoggerD("Enter");
for(size_t i = 0; i < path.length(); ++i) {
const char& cur = path[i];
if(cur != '/' && cur != '\\') {
@@ -477,6 +485,7 @@ std::string removeDirCharsFromFront(const std::string& path)
std::string generateFullPathForZip(const std::string& path)
{
+ LoggerD("Enter");
//Step 1: Remove / from begining
const size_t path_len = path.length();
@@ -512,6 +521,7 @@ std::string generateFullPathForZip(const std::string& path)
std::string ZipAddRequest::getNameInZipArchiveFor(filesystem::NodePtr node, bool strip)
{
+ LoggerD("Enter");
const std::string node_full_path = node->getPath()->getFullPath();
std::string cut_path;