From bcf6479a5e479b73afb825c2cf331f2d7acfe73d Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Mon, 19 Nov 2018 04:22:19 -0800 Subject: [PATCH] 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 --- libs/fbjni/cxx/fbjni/detail/Exceptions.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/fbjni/cxx/fbjni/detail/Exceptions.cpp b/libs/fbjni/cxx/fbjni/detail/Exceptions.cpp index 3ccd7386b..e61beecaa 100644 --- a/libs/fbjni/cxx/fbjni/detail/Exceptions.cpp +++ b/libs/fbjni/cxx/fbjni/detail/Exceptions.cpp @@ -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 * file in the root directory of this source tree. @@ -120,13 +120,13 @@ void throwPendingJniExceptionAsCppException() { return; } - auto throwable = adopt_local(env->ExceptionOccurred()); + auto throwable = env->ExceptionOccurred(); if (!throwable) { throw std::runtime_error("Unable to get pending JNI exception."); } env->ExceptionClear(); - throw JniException(throwable); + throw JniException(adopt_local(throwable)); } void throwCppExceptionIf(bool condition) {