Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#136 Pass-Through JNI exceptions to caller in waitEvents #137

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/cpp/_nix_based/jssc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,9 @@ JNIEXPORT jobjectArray JNICALL Java_jssc_SerialNativeInterface_waitEvents
(JNIEnv *env, jobject, jlong portHandle) {

jclass intClass = env->FindClass("[I");
if( intClass == NULL ) return NULL;
jobjectArray returnArray = env->NewObjectArray(sizeof(events)/sizeof(jint), intClass, NULL);
if( returnArray == NULL ) return NULL;

/*Input buffer*/
jint bytesCountIn = 0;
Expand Down Expand Up @@ -890,8 +892,11 @@ JNIEXPORT jobjectArray JNICALL Java_jssc_SerialNativeInterface_waitEvents
forEnd: {
returnValues[0] = events[i];
jintArray singleResultArray = env->NewIntArray(2);
if( singleResultArray == NULL ) return NULL;
env->SetIntArrayRegion(singleResultArray, 0, 2, returnValues);
if( env->ExceptionCheck() ) return NULL;
env->SetObjectArrayElement(returnArray, i, singleResultArray);
tresf marked this conversation as resolved.
Show resolved Hide resolved
if( env->ExceptionCheck() ) return NULL;
};
}
return returnArray;
Expand Down