From bcb6c2cd110d354b3e40ccbbace24456b92b92d5 Mon Sep 17 00:00:00 2001 From: songbao1 Date: Tue, 4 Mar 2025 15:33:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=90=88=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: songbao1 --- services/ans/src/notification_preferences_database.cpp | 8 ++++++-- services/ans/src/notification_rdb_data_mgr.cpp | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index cb0bb0006..72293fb5c 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -1789,7 +1789,7 @@ int32_t NotificationPreferencesDatabase::GetKvFromDb( int32_t result = rdbDataManager_->QueryData(key, value, userId); if (result != NativeRdb::E_OK) { - ANS_LOGE("Get key-value failed, key %{public}s, result %{pubic}d.", key.c_str(), result); + ANS_LOGE("Get key-value failed, key %{public}s, result %{public}d.", key.c_str(), result); return NativeRdb::E_ERROR; } @@ -1808,7 +1808,7 @@ int32_t NotificationPreferencesDatabase::GetByteFromDb( int32_t result = rdbDataManager_->QueryData(key, value, userId); if (result != NativeRdb::E_OK) { - ANS_LOGE("Get byte failed, key %{public}s, result %{pubic}d.", key.c_str(), result); + ANS_LOGE("Get byte failed, key %{public}s, result %{public}d.", key.c_str(), result); return NativeRdb::E_ERROR; } @@ -2210,6 +2210,10 @@ void NotificationPreferencesDatabase::GetAllCloneBundleInfo(const int32_t &userI for (auto item : values) { NotificationCloneBundleInfo bundleInfo; + if (item.second.empty() || nlohmann::json::accept(item,second)) { + ANS_LOGE("Invalid accept json"); + continue; + } nlohmann::json jsonObject = nlohmann::json::parse(item.second, nullptr, false); if (jsonObject.is_null() || !jsonObject.is_object()) { ANS_LOGE("Invalid JSON object"); diff --git a/services/ans/src/notification_rdb_data_mgr.cpp b/services/ans/src/notification_rdb_data_mgr.cpp index f34bf9d19..ec4e58f56 100644 --- a/services/ans/src/notification_rdb_data_mgr.cpp +++ b/services/ans/src/notification_rdb_data_mgr.cpp @@ -62,7 +62,7 @@ int32_t RdbStoreDataCallBackNotificationStorage::OnCreate(NativeRdb::RdbStore &r int32_t RdbStoreDataCallBackNotificationStorage::OnUpgrade( NativeRdb::RdbStore &rdbStore, int32_t oldVersion, int32_t newVersion) { - ANS_LOGD("OnUpgrade currentVersion: %{plubic}d, targetVersion: %{plubic}d", + ANS_LOGD("OnUpgrade currentVersion: %{plublic}d, targetVersion: %{plublic}d", oldVersion, newVersion); return NativeRdb::E_OK; } @@ -70,7 +70,7 @@ int32_t RdbStoreDataCallBackNotificationStorage::OnUpgrade( int32_t RdbStoreDataCallBackNotificationStorage::OnDowngrade( NativeRdb::RdbStore &rdbStore, int currentVersion, int targetVersion) { - ANS_LOGD("OnDowngrade currentVersion: %{plubic}d, targetVersion: %{plubic}d", + ANS_LOGD("OnDowngrade currentVersion: %{plublic}d, targetVersion: %{plublic}d", currentVersion, targetVersion); return NativeRdb::E_OK; } @@ -604,7 +604,7 @@ int32_t NotificationDataMgr::GetUserTableName(const int32_t &userId, std::string + " (KEY TEXT NOT NULL PRIMARY KEY, VALUE TEXT NOT NULL);"; int32_t ret = rdbStore_->ExecuteSql(createTableSql); if (ret != NativeRdb::E_OK) { - ANS_LOGW("createTable %{public}s failed, code: %{code}d", tableName.c_str(), ret); + ANS_LOGW("createTable %{public}s failed, code: %{public}d", tableName.c_str(), ret); return ret; } createdTables_.insert(tableName); -- Gitee From b1530e23671d6dd817e80b96f42781ed43bb0b20 Mon Sep 17 00:00:00 2001 From: luojingsong Date: Tue, 25 Mar 2025 06:27:57 +0000 Subject: [PATCH 2/2] update services/ans/src/notification_preferences_database.cpp. Signed-off-by: luojingsong --- services/ans/src/notification_preferences_database.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index 72293fb5c..31658f9ea 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -2210,7 +2210,7 @@ void NotificationPreferencesDatabase::GetAllCloneBundleInfo(const int32_t &userI for (auto item : values) { NotificationCloneBundleInfo bundleInfo; - if (item.second.empty() || nlohmann::json::accept(item,second)) { + if (item.second.empty() || nlohmann::json::accept(item.second)) { ANS_LOGE("Invalid accept json"); continue; } -- Gitee