Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Dec 22, 2023
1 parent 5cbfa7a commit dec780d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/app/CASESessionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ class CASESessionManager : public OperationalSessionReleaseDelegate, public Sess
* The `attemptCount` parameter can be used to automatically retry multiple times if session setup is
* not successful.
*
* This function allows passing 'nullptr' for the error handler to compile, which is useful in scenarios where error
* handling is not needed.
*
* @param peerId The node ID to find or establish a session with.
* @param onConnection A callback to be called upon successful connection establishment.
* @param attemptCount The number of retry attempts if session setup fails (default is 1).
Expand Down
2 changes: 1 addition & 1 deletion src/controller/java/AndroidCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void GetConnectedDeviceCallback::OnDeviceConnectionFailureFn(void * context,

jthrowable exception;
CHIP_ERROR err = AndroidConnectionFailureExceptions::GetInstance().CreateAndroidConnectionFailureException(
env, ErrorStr(failureInfo.error), failureInfo.error.AsInteger(), failureInfo.sessionStage, exception);
env, failureInfo.error.Format(), failureInfo.error.AsInteger(), failureInfo.sessionStage, exception);
VerifyOrReturn(
err == CHIP_NO_ERROR,
ChipLogError(Controller,
Expand Down
9 changes: 4 additions & 5 deletions src/controller/java/AndroidConnectionFailureExceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ CHIP_ERROR AndroidConnectionFailureExceptions::CreateAndroidConnectionFailureExc
jthrowable & outEx)
{
jclass controllerExceptionCls;
CHIP_ERROR err =
JniReferences::GetInstance().GetClassRef(env, "chip/devicecontroller/ConnectionFailureException", controllerExceptionCls);
CHIP_ERROR err = JniReferences::GetInstance().GetLocalClassRef(env, "chip/devicecontroller/ConnectionFailureException",
controllerExceptionCls);
VerifyOrReturnError(err == CHIP_NO_ERROR, CHIP_JNI_ERROR_TYPE_NOT_FOUND);
JniClass controllerExceptionJniCls(controllerExceptionCls);

jmethodID exceptionConstructor = env->GetMethodID(controllerExceptionCls, "<init>", "(JILjava/lang/String;)V");
outEx = (jthrowable) env->NewObject(controllerExceptionCls, exceptionConstructor, static_cast<jlong>(errorCode),
static_cast<jint>(state), env->NewStringUTF(message));
outEx = static_cast<jthrowable>(env->NewObject(controllerExceptionCls, exceptionConstructor, static_cast<jlong>(errorCode),
static_cast<jint>(state), env->NewStringUTF(message)));
VerifyOrReturnError(outEx != nullptr, CHIP_JNI_ERROR_TYPE_NOT_FOUND);
return CHIP_NO_ERROR;
}
Expand Down

0 comments on commit dec780d

Please sign in to comment.