aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/jni/helper_base.cxx8
-rw-r--r--java/jni/helper_base.hpp1
2 files changed, 8 insertions, 1 deletions
diff --git a/java/jni/helper_base.cxx b/java/jni/helper_base.cxx
index 518b28a5..344a722f 100644
--- a/java/jni/helper_base.cxx
+++ b/java/jni/helper_base.cxx
@@ -236,6 +236,10 @@ void raise_java_exception(JNIEnv *env, const std::bad_alloc &e, const char* file
print_native_caught_exception_fwd2java(e, file, line);
env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"), e.what());
}
+void raise_java_exception(JNIEnv *env, const direct_bt::OutOfMemoryError &e, const char* file, int line) {
+ print_native_caught_exception_fwd2java(e, file, line);
+ env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"), e.what());
+}
void raise_java_exception(JNIEnv *env, const direct_bt::BluetoothException &e, const char* file, int line) {
print_native_caught_exception_fwd2java(e, file, line);
env->ThrowNew(env->FindClass("org/tinyb/BluetoothException"), e.what());
@@ -252,7 +256,9 @@ void rethrow_and_raise_java_exception_impl(JNIEnv *env, const char* file, int li
try {
// std::rethrow_exception(e);
throw; // re-throw current exception
- } catch (const std::bad_alloc &e) { \
+ } catch (const std::bad_alloc &e) {
+ raise_java_exception(env, e, file, line);
+ } catch (const direct_bt::OutOfMemoryError &e) {
raise_java_exception(env, e, file, line);
} catch (const direct_bt::InternalError &e) {
raise_java_exception(env, e, file, line);
diff --git a/java/jni/helper_base.hpp b/java/jni/helper_base.hpp
index 45372406..164f6793 100644
--- a/java/jni/helper_base.hpp
+++ b/java/jni/helper_base.hpp
@@ -252,6 +252,7 @@ void raise_java_exception(JNIEnv *env, const direct_bt::IllegalStateException &e
void raise_java_exception(JNIEnv *env, const direct_bt::UnsupportedOperationException &e, const char* file, int line);
void raise_java_exception(JNIEnv *env, const direct_bt::IndexOutOfBoundsException &e, const char* file, int line);
void raise_java_exception(JNIEnv *env, const std::bad_alloc &e, const char* file, int line);
+void raise_java_exception(JNIEnv *env, const direct_bt::OutOfMemoryError &e, const char* file, int line);
void raise_java_exception(JNIEnv *env, const direct_bt::BluetoothException &e, const char* file, int line);
void raise_java_exception(JNIEnv *env, const tinyb::BluetoothException &e, const char* file, int line);