Signed-off-by: sodanotgreen <limengzheng@huawei.com>
This commit is contained in:
sodanotgreen 2024-07-30 10:56:53 +08:00
parent 230350e693
commit 7737c389e8
7 changed files with 62 additions and 66 deletions

View File

@ -67,7 +67,7 @@ void JsErrorObserver::CallJsFunction(napi_value obj, const char* methodName, nap
{
TAG_LOGD(AAFwkTag::JSNAPI, "call method:%{public}s", methodName);
if (obj == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "Failed to get object");
TAG_LOGE(AAFwkTag::JSNAPI, "null obj");
return;
}

View File

@ -1490,7 +1490,7 @@ void ConnectionCallback::Reset()
}
uv_work_t *work = new(std::nothrow) uv_work_t;
if (work == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "work == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null work");
return;
}
ConnectionCallback *data = new(std::nothrow) ConnectionCallback(std::move(*this));
@ -1549,16 +1549,16 @@ size_t NAPIAbilityConnection::RemoveAllCallbacks(ConnectRemoveKeyType key)
void UvWorkOnAbilityConnectDone(uv_work_t *work, int status)
{
TAG_LOGI(AAFwkTag::JSNAPI, "UvWorkOnAbilityConnectDone, uv_queue_work");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
std::unique_ptr<uv_work_t> managedWork(work);
if (work == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "UvWorkOnAbilityConnectDone, work is null");
TAG_LOGE(AAFwkTag::JSNAPI, "null work");
return;
}
// JS Thread
std::unique_ptr<ConnectAbilityCB> connectAbilityCB(static_cast<ConnectAbilityCB *>(work->data));
if (connectAbilityCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "UvWorkOnAbilityConnectDone, connectAbilityCB is null");
TAG_LOGE(AAFwkTag::JSNAPI, "null connectAbilityCB");
return;
}
CallbackInfo &cbInfo = connectAbilityCB->cbBase.cbInfo;
@ -1599,7 +1599,6 @@ void UvWorkOnAbilityConnectDone(uv_work_t *work, int status)
napi_delete_reference(cbInfo.env, cbInfo.callback);
}
napi_close_handle_scope(cbInfo.env, scope);
TAG_LOGI(AAFwkTag::JSNAPI, "UvWorkOnAbilityConnectDone, uv_queue_work end");
}
void NAPIAbilityConnection::HandleOnAbilityConnectDone(ConnectionCallback &callback, int resultCode)
@ -1608,19 +1607,19 @@ void NAPIAbilityConnection::HandleOnAbilityConnectDone(ConnectionCallback &callb
uv_loop_s *loop = nullptr;
napi_get_uv_event_loop(callback.env, &loop);
if (loop == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, loop == null.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "null loop");
return;
}
uv_work_t *work = new(std::nothrow) uv_work_t;
if (work == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, work == null.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "null work");
return;
}
ConnectAbilityCB *connectAbilityCB = new (std::nothrow) ConnectAbilityCB;
if (connectAbilityCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, connectAbilityCB == null.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "null connectAbilityCB");
if (work != nullptr) {
delete work;
work = nullptr;
@ -1665,21 +1664,20 @@ void NAPIAbilityConnection::OnAbilityConnectDone(
HandleOnAbilityConnectDone(*callback, resultCode);
}
connectionState_ = CONNECTION_STATE_CONNECTED;
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s, end.", __func__);
}
void UvWorkOnAbilityDisconnectDone(uv_work_t *work, int status)
{
TAG_LOGI(AAFwkTag::JSNAPI, "UvWorkOnAbilityDisconnectDone, uv_queue_work");
TAG_LOGD(AAFwkTag::JSNAPI, "called");
std::unique_ptr<uv_work_t> managedWork(work);
if (work == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "UvWorkOnAbilityDisconnectDone, work is null");
TAG_LOGE(AAFwkTag::JSNAPI, "null work");
return;
}
// JS Thread
std::unique_ptr<ConnectAbilityCB> connectAbilityCB(static_cast<ConnectAbilityCB *>(work->data));
if (connectAbilityCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "UvWorkOnAbilityDisconnectDone, connectAbilityCB is null");
TAG_LOGE(AAFwkTag::JSNAPI, "null connectAbilityCB");
return;
}
CallbackInfo &cbInfo = connectAbilityCB->cbBase.cbInfo;
@ -1704,7 +1702,7 @@ void UvWorkOnAbilityDisconnectDone(uv_work_t *work, int status)
// release connect
std::lock_guard<std::mutex> lock(g_connectionsLock_);
TAG_LOGI(AAFwkTag::JSNAPI, "UvWorkOnAbilityDisconnectDone connects_.size:%{public}zu", connects_.size());
TAG_LOGI(AAFwkTag::JSNAPI, "connects_.size:%{public}zu", connects_.size());
std::string deviceId = connectAbilityCB->abilityConnectionCB.elementName.GetDeviceID();
std::string bundleName = connectAbilityCB->abilityConnectionCB.elementName.GetBundleName();
std::string abilityName = connectAbilityCB->abilityConnectionCB.elementName.GetAbilityName();
@ -1718,9 +1716,8 @@ void UvWorkOnAbilityDisconnectDone(uv_work_t *work, int status)
if (item != connects_.end()) {
// match deviceid & bundlename && abilityname
connects_.erase(item);
TAG_LOGI(AAFwkTag::JSNAPI, "UvWorkOnAbilityDisconnectDone erase connects_.size:%{public}zu", connects_.size());
TAG_LOGI(AAFwkTag::JSNAPI, "erase connects_.size:%{public}zu", connects_.size());
}
TAG_LOGI(AAFwkTag::JSNAPI, "UvWorkOnAbilityDisconnectDone, uv_queue_work end");
}
void NAPIAbilityConnection::HandleOnAbilityDisconnectDone(ConnectionCallback &callback, int resultCode)
@ -1729,19 +1726,19 @@ void NAPIAbilityConnection::HandleOnAbilityDisconnectDone(ConnectionCallback &ca
uv_loop_s *loop = nullptr;
napi_get_uv_event_loop(callback.env, &loop);
if (loop == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, loop == nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "null loop", __func__);
return;
}
uv_work_t *work = new(std::nothrow) uv_work_t;
if (work == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "work == nullptr.");
TAG_LOGE(AAFwkTag::JSNAPI, "null work");
return;
}
ConnectAbilityCB *connectAbilityCB = new (std::nothrow) ConnectAbilityCB;
if (connectAbilityCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "%{public}s, connectAbilityCB == nullptr.", __func__);
TAG_LOGE(AAFwkTag::JSNAPI, "null connectAbilityCB");
if (work != nullptr) {
delete work;
work = nullptr;
@ -1780,7 +1777,6 @@ void NAPIAbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementNam
HandleOnAbilityDisconnectDone(*callback, resultCode);
}
connectionState_ = CONNECTION_STATE_DISCONNECTED;
TAG_LOGI(AAFwkTag::JSNAPI, "%{public}s, end.", __func__);
}
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -260,7 +260,7 @@ napi_value NAPI_GetCacheDirCommon(napi_env env, napi_callback_info info, Ability
asyncCallbackInfo->abilityType = abilityType;
napi_value ret = NAPI_GetCacheDirWrap(env, info, asyncCallbackInfo);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
FreeAsyncJSCallbackInfo(&asyncCallbackInfo);
ret = WrapVoidToJS(env);
}
@ -328,7 +328,7 @@ napi_value NAPI_GetExternalCacheDirCommon(napi_env env, napi_callback_info info,
asyncCallbackInfo->abilityType = abilityType;
napi_value ret = NAPI_GetExternalCacheDirWrap(env, info, asyncCallbackInfo);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
FreeAsyncJSCallbackInfo(&asyncCallbackInfo);
ret = WrapVoidToJS(env);
}
@ -429,7 +429,7 @@ napi_value NAPI_IsUpdatingConfigurationsCommon(napi_env env, napi_callback_info
asyncCallbackInfo->abilityType = abilityType;
napi_value ret = NAPI_IsUpdatingConfigurationsWrap(env, info, asyncCallbackInfo);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
FreeAsyncJSCallbackInfo(&asyncCallbackInfo);
ret = WrapVoidToJS(env);
}
@ -449,7 +449,7 @@ napi_value NAPI_PrintDrawnCompletedCommon(napi_env env, napi_callback_info info,
asyncCallbackInfo->abilityType = abilityType;
napi_value ret = NAPI_PrintDrawnCompletedWrap(env, info, asyncCallbackInfo);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
FreeAsyncJSCallbackInfo(&asyncCallbackInfo);
ret = WrapVoidToJS(env);
}
@ -477,7 +477,7 @@ napi_value NAPI_GetAppTypeCommon(napi_env env, napi_callback_info info, AbilityT
appTypeCB->cbBase.abilityType = abilityType;
napi_value ret = GetAppTypeWrap(env, info, appTypeCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (appTypeCB != nullptr) {
delete appTypeCB;
appTypeCB = nullptr;
@ -584,7 +584,7 @@ napi_value NAPI_GetDisplayOrientationCommon(napi_env env, napi_callback_info inf
asyncCallbackInfo->abilityType = abilityType;
napi_value ret = GetDisplayOrientationWrap(env, info, asyncCallbackInfo);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
FreeAsyncJSCallbackInfo(&asyncCallbackInfo);
ret = WrapVoidToJS(env);
}
@ -613,7 +613,7 @@ napi_value NAPI_GetAbilityInfoCommon(napi_env env, napi_callback_info info, Abil
abilityInfoCB->cbBase.abilityType = abilityType;
napi_value ret = GetAbilityInfoWrap(env, info, abilityInfoCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (abilityInfoCB != nullptr) {
delete abilityInfoCB;
abilityInfoCB = nullptr;
@ -644,7 +644,7 @@ napi_value NAPI_GetHapModuleInfoCommon(napi_env env, napi_callback_info info, Ab
hapModuleInfoCB->cbBase.abilityType = abilityType;
napi_value ret = GetHapModuleInfoWrap(env, info, hapModuleInfoCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (hapModuleInfoCB != nullptr) {
delete hapModuleInfoCB;
hapModuleInfoCB = nullptr;
@ -675,7 +675,7 @@ napi_value NAPI_GetAppVersionInfoCommon(napi_env env, napi_callback_info info, A
appVersionInfoCB->cbBase.abilityType = abilityType;
napi_value ret = GetAppVersionInfoWrap(env, info, appVersionInfoCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (appVersionInfoCB != nullptr) {
delete appVersionInfoCB;
appVersionInfoCB = nullptr;
@ -697,7 +697,7 @@ AsyncCallbackInfo *CreateAsyncCallbackInfo(napi_env env)
{
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (env == nullptr) {
TAG_LOGI(AAFwkTag::JSNAPI, "env == nullptr");
TAG_LOGI(AAFwkTag::JSNAPI, "null env");
return nullptr;
}
@ -729,7 +729,7 @@ AsyncCallbackInfo *CreateAsyncCallbackInfo(napi_env env)
AsyncCallbackInfo *asyncCallbackInfo = new (std::nothrow) AsyncCallbackInfo;
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null asyncCallbackInfo");
return nullptr;
}
asyncCallbackInfo->cbInfo.env = env;
@ -748,12 +748,12 @@ void GetContextAsyncExecuteCB(napi_env, void *data)
TAG_LOGI(AAFwkTag::JSNAPI, "worker pool thread execute");
AsyncCallbackInfo *asyncCallbackInfo = static_cast<AsyncCallbackInfo *>(data);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null asyncCallbackInfo");
return;
}
asyncCallbackInfo->errCode = NAPI_ERR_NO_ERROR;
if (asyncCallbackInfo->ability == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ability == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ability");
asyncCallbackInfo->errCode = NAPI_ERR_ACE_ABILITY;
return;
}
@ -771,7 +771,7 @@ napi_value GetContextAsync(
{
TAG_LOGI(AAFwkTag::JSNAPI, "asyncCallback");
if (args == nullptr || asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "parameter == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null parameter");
return nullptr;
}
napi_value resourceName = nullptr;
@ -821,7 +821,7 @@ napi_value GetContextPromise(napi_env env, AsyncCallbackInfo *asyncCallbackInfo)
{
TAG_LOGI(AAFwkTag::JSNAPI, "promise");
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "param == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null param");
return nullptr;
}
napi_value resourceName = nullptr;
@ -872,7 +872,7 @@ napi_value GetContextWrap(napi_env env, napi_callback_info, AsyncCallbackInfo *a
{
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null asyncCallbackInfo");
return nullptr;
}
@ -902,7 +902,7 @@ napi_value NAPI_GetContextCommon(napi_env env, napi_callback_info info, AbilityT
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncCallbackInfo *asyncCallbackInfo = CreateAsyncCallbackInfo(env);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null asyncCallbackInfo");
return WrapVoidToJS(env);
}
@ -915,7 +915,7 @@ napi_value NAPI_GetContextCommon(napi_env env, napi_callback_info info, AbilityT
if (ret == nullptr) {
ret = WrapVoidToJS(env);
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
} else {
}
@ -934,7 +934,7 @@ napi_value NAPI_GetWantCommon(napi_env env, napi_callback_info info, AbilityType
{
AsyncCallbackInfo *asyncCallbackInfo = CreateAsyncCallbackInfo(env);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null asyncCallbackInfo");
return WrapVoidToJS(env);
}
@ -942,7 +942,7 @@ napi_value NAPI_GetWantCommon(napi_env env, napi_callback_info info, AbilityType
asyncCallbackInfo->abilityType = abilityType;
napi_value ret = GetWantWrap(env, info, asyncCallbackInfo);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (asyncCallbackInfo != nullptr) {
delete asyncCallbackInfo;
asyncCallbackInfo = nullptr;
@ -965,7 +965,7 @@ napi_value NAPI_GetAbilityNameCommon(napi_env env, napi_callback_info info, Abil
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AbilityNameCB *abilityNameCB = CreateAbilityNameCBInfo(env);
if (abilityNameCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "abilityNameCB == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null abilityNameCB");
return WrapVoidToJS(env);
}
@ -973,7 +973,7 @@ napi_value NAPI_GetAbilityNameCommon(napi_env env, napi_callback_info info, Abil
abilityNameCB->cbBase.abilityType = abilityType;
napi_value ret = GetAbilityNameWrap(env, info, abilityNameCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (abilityNameCB != nullptr) {
delete abilityNameCB;
abilityNameCB = nullptr;
@ -1005,7 +1005,7 @@ napi_value NAPI_StopAbilityCommon(napi_env env, napi_callback_info info, Ability
asyncCallbackInfo->abilityType = abilityType;
napi_value ret = StopAbilityWrap(env, info, asyncCallbackInfo);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
FreeAsyncJSCallbackInfo(&asyncCallbackInfo);
ret = WrapVoidToJS(env);
}
@ -1031,7 +1031,7 @@ napi_value NAPI_AcquireDataAbilityHelperCommon(napi_env env, napi_callback_info
dataAbilityHelperCB->cbBase.abilityType = abilityType;
napi_value ret = AcquireDataAbilityHelperWrap(env, info, dataAbilityHelperCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (dataAbilityHelperCB != nullptr) {
delete dataAbilityHelperCB;
dataAbilityHelperCB = nullptr;
@ -1053,7 +1053,7 @@ napi_value NAPI_AcquireDataAbilityHelperCommon(napi_env env, napi_callback_info
napi_value AcquireDataAbilityHelperWrap(napi_env env, napi_callback_info info, DataAbilityHelperCB *dataAbilityHelperCB)
{
if (dataAbilityHelperCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "dataAbilityHelperCB == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null dataAbilityHelperCB");
return nullptr;
}
@ -1127,14 +1127,14 @@ napi_value NAPI_StartBackgroundRunningCommon(napi_env env, napi_callback_info in
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncCallbackInfo *asyncCallbackInfo = CreateAsyncCallbackInfo(env);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null asyncCallbackInfo");
return WrapVoidToJS(env);
}
asyncCallbackInfo->errCode = NAPI_ERR_NO_ERROR;
napi_value ret = StartBackgroundRunningWrap(env, info, asyncCallbackInfo);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == null");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (asyncCallbackInfo != nullptr) {
delete asyncCallbackInfo;
asyncCallbackInfo = nullptr;
@ -1150,14 +1150,14 @@ napi_value NAPI_CancelBackgroundRunningCommon(napi_env env, napi_callback_info i
TAG_LOGI(AAFwkTag::JSNAPI, "called");
AsyncCallbackInfo *asyncCallbackInfo = CreateAsyncCallbackInfo(env);
if (asyncCallbackInfo == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "asyncCallbackInfo == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null asyncCallbackInfo");
return WrapVoidToJS(env);
}
asyncCallbackInfo->errCode = NAPI_ERR_NO_ERROR;
napi_value ret = CancelBackgroundRunningWrap(env, info, asyncCallbackInfo);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (asyncCallbackInfo != nullptr) {
delete asyncCallbackInfo;
asyncCallbackInfo = nullptr;

View File

@ -2317,7 +2317,7 @@ napi_value NAPI_GetBundleName(napi_env env, napi_callback_info info)
napi_value ret = NAPI_GetBundleNameWrap(env, info, asyncCallbackInfo);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
FreeAsyncJSCallbackInfo(&asyncCallbackInfo);
ret = WrapVoidToJS(env);
}
@ -2335,7 +2335,7 @@ napi_value NAPI_GetApplicationInfo(napi_env env, napi_callback_info info)
napi_value ret = GetApplicationInfoWrap(env, info, appInfoCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (appInfoCB != nullptr) {
delete appInfoCB;
appInfoCB = nullptr;
@ -2357,7 +2357,7 @@ napi_value NAPI_GetProcessInfo(napi_env env, napi_callback_info info)
processInfoCB->cbBase.errCode = NAPI_ERR_NO_ERROR;
napi_value ret = GetProcessInfoWrap(env, info, processInfoCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (processInfoCB != nullptr) {
delete processInfoCB;
processInfoCB = nullptr;
@ -2379,7 +2379,7 @@ napi_value NAPI_GetElementName(napi_env env, napi_callback_info info)
elementNameCB->cbBase.errCode = NAPI_ERR_NO_ERROR;
napi_value ret = GetElementNameWrap(env, info, elementNameCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (elementNameCB != nullptr) {
delete elementNameCB;
elementNameCB = nullptr;
@ -2401,7 +2401,7 @@ napi_value NAPI_GetProcessName(napi_env env, napi_callback_info info)
processNameCB->cbBase.errCode = NAPI_ERR_NO_ERROR;
napi_value ret = GetProcessNameWrap(env, info, processNameCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (processNameCB != nullptr) {
delete processNameCB;
processNameCB = nullptr;
@ -2423,7 +2423,7 @@ napi_value NAPI_GetCallingBundle(napi_env env, napi_callback_info info)
callingBundleCB->cbBase.errCode = NAPI_ERR_NO_ERROR;
napi_value ret = GetCallingBundleWrap(env, info, callingBundleCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (callingBundleCB != nullptr) {
delete callingBundleCB;
callingBundleCB = nullptr;
@ -2445,7 +2445,7 @@ napi_value NAPI_GetOrCreateLocalDir(napi_env env, napi_callback_info info)
getOrCreateLocalDirCB->cbBase.errCode = NAPI_ERR_NO_ERROR;
napi_value ret = GetOrCreateLocalDirWrap(env, info, getOrCreateLocalDirCB);
if (ret == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
if (getOrCreateLocalDirCB != nullptr) {
delete getOrCreateLocalDirCB;
getOrCreateLocalDirCB = nullptr;
@ -2470,7 +2470,7 @@ DatabaseDirCB *CreateGetDatabaseDirCBInfo(napi_env env)
DatabaseDirCB *getDatabaseDirCB = new (std::nothrow) DatabaseDirCB;
if (getDatabaseDirCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "getDatabaseDirCB == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null getDatabaseDirCB");
return nullptr;
}
getDatabaseDirCB->cbBase.cbInfo.env = env;
@ -2486,7 +2486,7 @@ napi_value GetDatabaseDirWrap(napi_env env, napi_callback_info info, DatabaseDir
{
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (getDatabaseDirCB == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "getDatabaseDirCB == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null getDatabaseDirCB");
return nullptr;
}
@ -2546,7 +2546,7 @@ napi_value NAPI_GetDatabaseDirSync(napi_env env, napi_callback_info info)
if (ret == nullptr) {
ret = WrapVoidToJS(env);
TAG_LOGE(AAFwkTag::JSNAPI, "ret == nullptr");
TAG_LOGE(AAFwkTag::JSNAPI, "null ret");
} else {
TAG_LOGI(AAFwkTag::JSNAPI, "end");
}

View File

@ -60,7 +60,7 @@ bool UnwrapExecuteParam(napi_env env, napi_value param, InsightIntentExecutePara
napi_value napiIntentParam = nullptr;
napi_get_named_property(env, param, "insightIntentParam", &napiIntentParam);
if (napiIntentParam == nullptr) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type insightIntentParam");
TAG_LOGE(AAFwkTag::JSNAPI, "null napiIntentParam");
return false;
}
@ -72,7 +72,7 @@ bool UnwrapExecuteParam(napi_env env, napi_value param, InsightIntentExecutePara
}
auto wp = std::make_shared<WantParams>();
if (!AppExecFwk::UnwrapWantParams(env, napiIntentParam, *wp)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type intentParam, Unwrap want fail");
TAG_LOGE(AAFwkTag::JSNAPI, "unwrap want fail");
return false;
}
executeParam.insightIntentParam_ = wp;
@ -88,10 +88,10 @@ bool UnwrapExecuteParam(napi_env env, napi_value param, InsightIntentExecutePara
if (executeMode == ExecuteMode::UI_ABILITY_FOREGROUND &&
UnwrapInt32ByPropertyName(env, param, "displayId", displayId)) {
if (displayId < 0) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument displayId");
TAG_LOGE(AAFwkTag::JSNAPI, "invalid displayId");
return false;
}
TAG_LOGI(AAFwkTag::JSNAPI, "Get displayId %{public}d", displayId);
TAG_LOGI(AAFwkTag::JSNAPI, "displayId %{public}d", displayId);
executeParam.displayId_ = displayId;
}

View File

@ -47,12 +47,12 @@ bool UnwrapExecuteResult(napi_env env, napi_value param, InsightIntentExecuteRes
napi_valuetype valueType = napi_undefined;
napi_typeof(env, result, &valueType);
if (valueType != napi_object) {
TAG_LOGE(AAFwkTag::JSNAPI, "Wrong argument type result");
TAG_LOGE(AAFwkTag::JSNAPI, "type not function");
return false;
}
auto wp = std::make_shared<AAFwk::WantParams>();
if (!AppExecFwk::UnwrapWantParams(env, result, *wp)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Unwrap want fail, Wrong argument type result");
TAG_LOGE(AAFwkTag::JSNAPI, "unwrap want failed");
return false;
}
if (!executeResult.CheckResult(wp)) {

View File

@ -28,7 +28,7 @@ bool UnwrapOpenLinkOptions(napi_env env, napi_value param, AAFwk::OpenLinkOption
TAG_LOGI(AAFwkTag::JSNAPI, "called");
if (!IsTypeForNapiValue(env, param, napi_object)) {
TAG_LOGE(AAFwkTag::JSNAPI, "Params is invalid");
TAG_LOGE(AAFwkTag::JSNAPI, "invalid params");
return false;
}