diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index cb0bb0006e3cfe85584bf5f95de9c8ce17257130..31658f9ea9782800a0f30cee5166731e1a5139f6 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 f34bf9d19e98bf0fe31d21e0e9cd054fea20b98b..ec4e58f56a4e59b92fece51fe1ffb4a5dfc3a431 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);