From 6646d59680e9271f3712650fea41f965ca229c89 Mon Sep 17 00:00:00 2001 From: Justin Dickow Date: Thu, 17 Jul 2014 14:10:20 -0400 Subject: [PATCH] app resumption component update Authors Dmitriy Klimenko Nikita Vaganov Signed-off-by: Justin Dickow --- src/components/resumption/src/last_state.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/resumption/src/last_state.cc b/src/components/resumption/src/last_state.cc index f694a99..0b7cd73 100644 --- a/src/components/resumption/src/last_state.cc +++ b/src/components/resumption/src/last_state.cc @@ -33,9 +33,12 @@ #include "resumption/last_state.h" #include "config_profile/profile.h" #include "utils/file_system.h" +#include "utils/logger.h" namespace resumption { +CREATE_LOGGERPTR_GLOBAL(logger_, "LastState"); + void LastState::SaveToFileSystem() { const std::string file = profile::Profile::instance()->app_info_storage(); @@ -50,12 +53,12 @@ void LastState::LoadFromFileSystem() { profile::Profile::instance()->app_info_storage(); std::string buffer; bool result = file_system::ReadFile(file, buffer); - if (result) { - Json::Reader m_reader; - DCHECK(m_reader.parse(buffer, dictionary)); - } else { - // Error + Json::Reader m_reader; + if (result && m_reader.parse(buffer, dictionary)) { + LOG4CXX_INFO(logger_, "Valid last state was found."); + return; } + LOG4CXX_WARN(logger_, "No valid last state was found."); } LastState::LastState() { -- 2.7.4