Fix Android exception jni type (#29066)
diff --git a/src/app/server/java/src/chip/appserver/ChipAppServerException.java b/src/app/server/java/src/chip/appserver/ChipAppServerException.java
index 08e11d1..7a036ec 100644
--- a/src/app/server/java/src/chip/appserver/ChipAppServerException.java
+++ b/src/app/server/java/src/chip/appserver/ChipAppServerException.java
@@ -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;
}
diff --git a/src/lib/support/JniReferences.cpp b/src/lib/support/JniReferences.cpp
index 870ec3f..6ad7e26 100644
--- a/src/lib/support/JniReferences.cpp
+++ b/src/lib/support/JniReferences.cpp
@@ -198,12 +198,12 @@
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);
}
diff --git a/src/platform/android/java/chip/platform/AndroidChipPlatformException.java b/src/platform/android/java/chip/platform/AndroidChipPlatformException.java
index 0a02517..9333e61 100644
--- a/src/platform/android/java/chip/platform/AndroidChipPlatformException.java
+++ b/src/platform/android/java/chip/platform/AndroidChipPlatformException.java
@@ -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;
}