Solve fbjni bug to allow catching Java exception in JNI
Summary: This diff just adds the changes done here D12829542 for the OSS Reviewed By: jknoxville Differential Revision: D12839582 fbshipit-source-id: 0bdfa9e8e661309454709819af703499cd540ab4
This commit is contained in:
committed by
Facebook Github Bot
parent
88b5f28b09
commit
bcf6479a5e
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-present, Facebook, Inc.
|
* Copyright (c) Facebook, Inc.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the LICENSE
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
@@ -120,13 +120,13 @@ void throwPendingJniExceptionAsCppException() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto throwable = adopt_local(env->ExceptionOccurred());
|
auto throwable = env->ExceptionOccurred();
|
||||||
if (!throwable) {
|
if (!throwable) {
|
||||||
throw std::runtime_error("Unable to get pending JNI exception.");
|
throw std::runtime_error("Unable to get pending JNI exception.");
|
||||||
}
|
}
|
||||||
env->ExceptionClear();
|
env->ExceptionClear();
|
||||||
|
|
||||||
throw JniException(throwable);
|
throw JniException(adopt_local(throwable));
|
||||||
}
|
}
|
||||||
|
|
||||||
void throwCppExceptionIf(bool condition) {
|
void throwCppExceptionIf(bool condition) {
|
||||||
|
|||||||
Reference in New Issue
Block a user