From f712b2e7666bca7fb5667ade867150c4d3dd10bd Mon Sep 17 00:00:00 2001 From: yunhanw Date: Thu, 27 Jun 2024 17:57:00 -0700 Subject: [PATCH] Fix JNI bug in clientType -- Fix icd clienttype with integer and align with generated type for clientType in other generated file -- Fix missing semicolon in the end of ()Ljava/lang/Short --- src/controller/java/AndroidDeviceControllerWrapper.cpp | 4 ++-- .../java/src/chip/devicecontroller/ICDRegistrationInfo.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controller/java/AndroidDeviceControllerWrapper.cpp b/src/controller/java/AndroidDeviceControllerWrapper.cpp index 32a595e3c9067c..af5d220295a983 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.cpp +++ b/src/controller/java/AndroidDeviceControllerWrapper.cpp @@ -527,7 +527,7 @@ CHIP_ERROR AndroidDeviceControllerWrapper::ApplyICDRegistrationInfo(chip::Contro jbyteArray jSymmetricKey = static_cast(env->CallObjectMethod(icdRegistrationInfo, getSymmetricKeyMethod)); jmethodID getClientTypeMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, icdRegistrationInfo, "getClientType", "()Ljava/lang/Short", + err = chip::JniReferences::GetInstance().FindMethod(env, icdRegistrationInfo, "getClientType", "()Ljava/lang/Integer;", &getClientTypeMethod); VerifyOrReturnError(err == CHIP_NO_ERROR, err); jobject jClientType = env->CallObjectMethod(icdRegistrationInfo, getClientTypeMethod); @@ -566,7 +566,7 @@ CHIP_ERROR AndroidDeviceControllerWrapper::ApplyICDRegistrationInfo(chip::Contro if (jClientType != nullptr) { clientType = static_cast( - chip::JniReferences::GetInstance().ShortToPrimitive(jClientType)); + chip::JniReferences::GetInstance().IntegerToPrimitive(jClientType)); } params.SetICDClientType(clientType); diff --git a/src/controller/java/src/chip/devicecontroller/ICDRegistrationInfo.java b/src/controller/java/src/chip/devicecontroller/ICDRegistrationInfo.java index 863a96425f4da4..68fa63518c76d9 100644 --- a/src/controller/java/src/chip/devicecontroller/ICDRegistrationInfo.java +++ b/src/controller/java/src/chip/devicecontroller/ICDRegistrationInfo.java @@ -24,7 +24,7 @@ public class ICDRegistrationInfo { @Nullable private final Long checkInNodeId; @Nullable private final Long monitoredSubject; @Nullable private final byte[] symmetricKey; - @Nullable private final Short clientType; + @Nullable private final Integer clientType; private ICDRegistrationInfo(Builder builder) { this.checkInNodeId = builder.checkInNodeId; @@ -48,7 +48,7 @@ public byte[] getSymmetricKey() { return symmetricKey; } - public Short getClientType() { + public Integer getClientType() { return clientType; }