mirror of
https://github.com/openharmony/distributedschedule_samgr.git
synced 2026-07-19 19:33:38 -04:00
!274 fix continuation manager bug
Merge pull request !274 from zhangmingxiang/0711
This commit is contained in:
@@ -439,18 +439,17 @@ bool JsContinuationManager::UnWrapContinuationExtraParams(const napi_env& env, c
|
||||
continuationExtraParams->SetDescription(descriptionString);
|
||||
}
|
||||
nlohmann::json filterJson;
|
||||
if (UnwrapJsonByPropertyName(env, options, "filter", filterJson)) {
|
||||
std::string filterString = filterJson.dump();
|
||||
continuationExtraParams->SetFilter(filterString);
|
||||
if (!UnwrapJsonByPropertyName(env, options, "filter", filterJson)) {
|
||||
return false;
|
||||
}
|
||||
continuationExtraParams->SetFilter(filterJson.dump());
|
||||
int32_t continuationMode = 0;
|
||||
if (UnwrapInt32ByPropertyName(env, options, "continuationMode", continuationMode)) {
|
||||
continuationExtraParams->SetContinuationMode(static_cast<ContinuationMode>(continuationMode));
|
||||
}
|
||||
nlohmann::json authInfoJson;
|
||||
if (UnwrapJsonByPropertyName(env, options, "authInfo", authInfoJson)) {
|
||||
std::string authInfoString = authInfoJson.dump();
|
||||
continuationExtraParams->SetAuthInfo(authInfoString);
|
||||
continuationExtraParams->SetAuthInfo(authInfoJson.dump());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -465,14 +464,16 @@ bool JsContinuationManager::UnwrapJsonByPropertyName(const napi_env& env, const
|
||||
}
|
||||
napi_value jsonField = nullptr;
|
||||
napi_get_named_property(env, param, fieldStr.c_str(), &jsonField);
|
||||
napi_valuetype jsonFieldType = napi_undefined;
|
||||
napi_typeof(env, jsonField, &jsonFieldType);
|
||||
if (jsonFieldType != napi_object && jsonFieldType != napi_undefined) {
|
||||
HILOGE("field: %{public}s is invalid json.", fieldStr.c_str());
|
||||
return false;
|
||||
}
|
||||
napi_value jsProNameList = nullptr;
|
||||
uint32_t jsProCount = 0;
|
||||
napi_get_property_names(env, jsonField, &jsProNameList);
|
||||
napi_get_array_length(env, jsProNameList, &jsProCount);
|
||||
if (jsProCount == 0) {
|
||||
HILOGE("field: %{public}s is invalid json.", fieldStr.c_str());
|
||||
return false;
|
||||
}
|
||||
if (!PraseJson(env, jsonField, jsProNameList, jsProCount, jsonObj)) {
|
||||
HILOGE("PraseJson failed.");
|
||||
return false;
|
||||
|
||||
@@ -76,7 +76,7 @@ int32_t DistributedAbilityManagerStub::RegisterInner(MessageParcel& data, Messag
|
||||
int32_t token = -1;
|
||||
ContinuationExtraParams* continuationExtraParams = nullptr;
|
||||
if (flag == VALUE_OBJECT) {
|
||||
ContinuationExtraParams* continuationExtraParams = data.ReadParcelable<ContinuationExtraParams>();
|
||||
continuationExtraParams = data.ReadParcelable<ContinuationExtraParams>();
|
||||
if (continuationExtraParams == nullptr) {
|
||||
HILOGE("ContinuationExtraParams readParcelable failed!");
|
||||
return ERR_NULL_OBJECT;
|
||||
@@ -159,7 +159,7 @@ int32_t DistributedAbilityManagerStub::StartDeviceManagerInner(MessageParcel& da
|
||||
PARCEL_READ_HELPER(data, Int32, flag);
|
||||
ContinuationExtraParams* continuationExtraParams = nullptr;
|
||||
if (flag == VALUE_OBJECT) {
|
||||
ContinuationExtraParams* continuationExtraParams = data.ReadParcelable<ContinuationExtraParams>();
|
||||
continuationExtraParams = data.ReadParcelable<ContinuationExtraParams>();
|
||||
if (continuationExtraParams == nullptr) {
|
||||
HILOGE("ContinuationExtraParams readParcelable failed!");
|
||||
return ERR_NULL_OBJECT;
|
||||
@@ -172,4 +172,4 @@ int32_t DistributedAbilityManagerStub::StartDeviceManagerInner(MessageParcel& da
|
||||
return ERR_NONE;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
Reference in New Issue
Block a user