Skip to content

Commit

Permalink
Fix Android exception jni type (#29066)
Browse files Browse the repository at this point in the history
  • Loading branch information
joonhaengHeo authored and pull[bot] committed Nov 17, 2023
1 parent eb725df commit 0ca955e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
public class ChipAppServerException extends RuntimeException {
private static final long serialVersionUID = 1L;

public int errorCode;
public long errorCode;

public ChipAppServerException() {}

public ChipAppServerException(int errorCode, String message) {
public ChipAppServerException(long errorCode, String message) {
super(message != null ? message : String.format("Error Code %d", errorCode));
this.errorCode = errorCode;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/support/JniReferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ void JniReferences::ReportError(JNIEnv * env, CHIP_ERROR cbErr, const char * fun
void JniReferences::ThrowError(JNIEnv * env, jclass exceptionCls, CHIP_ERROR errToThrow)
{
env->ExceptionClear();
jmethodID constructor = env->GetMethodID(exceptionCls, "<init>", "(ILjava/lang/String;)V");
jmethodID constructor = env->GetMethodID(exceptionCls, "<init>", "(JLjava/lang/String;)V");
VerifyOrReturn(constructor != NULL);

jstring jerrStr = env->NewStringUTF(ErrorStr(errToThrow));

jthrowable outEx = (jthrowable) env->NewObject(exceptionCls, constructor, static_cast<jint>(errToThrow.AsInteger()), jerrStr);
jthrowable outEx = (jthrowable) env->NewObject(exceptionCls, constructor, static_cast<jlong>(errToThrow.AsInteger()), jerrStr);
VerifyOrReturn(!env->ExceptionCheck());
env->Throw(outEx);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
public class AndroidChipPlatformException extends Exception {
private static final long serialVersionUID = 1L;

public int errorCode;
public long errorCode;

public AndroidChipPlatformException() {}

public AndroidChipPlatformException(int errorCode, String message) {
public AndroidChipPlatformException(long errorCode, String message) {
super(message != null ? message : String.format("Error Code %d", errorCode));
this.errorCode = errorCode;
}
Expand Down

0 comments on commit 0ca955e

Please sign in to comment.