Skip to content

Commit

Permalink
Handle error cases in Android OnAttributeData
Browse files Browse the repository at this point in the history
  • Loading branch information
g-coppock committed May 2, 2022
1 parent fb68954 commit 21b633d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/controller/java/AndroidCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,14 @@ void ReportCallback::OnAttributeData(const app::ConcreteDataAttributePath & aPat
// Convert TLV to JSON
Json::Value json;
err = TlvToJson(readerForJson, json);
VerifyOrReturn(err == CHIP_NO_ERROR, ReportError(attributePathObj, err));

UtfString jsonString(env, JsonToString(json).c_str());

// Create AttributeState object
jclass attributeStateCls;
err = JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/model/AttributeState", attributeStateCls);
VerifyOrReturnError(err == CHIP_NO_ERROR, ChipLogError(Controller, "Could not find AttributeState class"));
VerifyOrReturn(attributeStateCls != nullptr, ChipLogError(Controller, "Could not find AttributeState class"));
chip::JniClass attributeStateJniCls(attributeStateCls);
jmethodID attributeStateCtor = env->GetMethodID(attributeStateCls, "<init>", "(Ljava/lang/Object;[BLjava/lang/String;)V");
Expand Down
1 change: 1 addition & 0 deletions third_party/bluez/repo
Submodule repo added at bb12ef
1 change: 1 addition & 0 deletions third_party/happy/repo
Submodule repo added at 72a4b6

0 comments on commit 21b633d

Please sign in to comment.