From 116c28fb52228ccaeb96d985f5a4609e23db6a9f Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Fri, 16 Feb 2024 20:16:18 -0800 Subject: [PATCH] fix report status in android (#32167) --- src/controller/java/AndroidCallbacks.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/controller/java/AndroidCallbacks.cpp b/src/controller/java/AndroidCallbacks.cpp index cc6107cae3a431..eb6e8b1a5f255b 100644 --- a/src/controller/java/AndroidCallbacks.cpp +++ b/src/controller/java/AndroidCallbacks.cpp @@ -281,9 +281,8 @@ void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPat jobject wrapperCallback = mWrapperCallbackRef.ObjectRef(); jobject nodeState = GetNodeStateObj(env, mNodeStateClassSignature, wrapperCallback); - if (aStatus.IsFailure()) + { - ChipLogError(Controller, "Receive bad status %s", ErrorStr(aStatus.ToChipError())); // Add Attribute Status to wrapperCallback jmethodID addAttributeStatusMethod = nullptr; err = JniReferences::GetInstance().FindMethod(env, nodeState, "addAttributeStatus", "(IJJILjava/lang/Integer;)V", @@ -305,8 +304,10 @@ void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPat static_cast(aPath.mClusterId), static_cast(aPath.mAttributeId), static_cast(aStatus.mStatus), jClusterState); VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe()); - return; } + + VerifyOrReturn(aStatus.IsSuccess(), ChipLogError(Controller, "Receive bad status %s", ErrorStr(aStatus.ToChipError())); + aPath.LogPath()); VerifyOrReturn(apData != nullptr, ChipLogError(Controller, "Receive empty apData"); aPath.LogPath()); TLV::TLVReader readerForJavaTLV; @@ -415,9 +416,8 @@ void ReportCallback::OnEventData(const app::EventHeader & aEventHeader, TLV::TLV ChipLogError(Controller, "mReportCallbackRef is not valid in %s", __func__)); jobject wrapperCallback = mWrapperCallbackRef.ObjectRef(); jobject nodeState = GetNodeStateObj(env, mNodeStateClassSignature, wrapperCallback); - if (apStatus != nullptr && apStatus->IsFailure()) + if (apStatus != nullptr) { - ChipLogError(Controller, "Receive bad status %s", ErrorStr(apStatus->ToChipError())); // Add Event Status to NodeState jmethodID addEventStatusMethod; err = JniReferences::GetInstance().FindMethod(env, nodeState, "addEventStatus", "(IJJILjava/lang/Integer;)V",