mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 09:49:19 +02:00
do not throw exceptions from native code: this does not work on some devices
This commit is contained in:
parent
64de74460d
commit
ebe5fc182c
5 changed files with 14 additions and 47 deletions
|
@ -128,8 +128,6 @@ shared_ptr<VoidMethod> AndroidUtil::Method_NativeBookModel_addImage;
|
|||
shared_ptr<VoidMethod> AndroidUtil::Method_NativeBookModel_registerFontFamilyList;
|
||||
shared_ptr<VoidMethod> AndroidUtil::Method_NativeBookModel_registerFontEntry;
|
||||
|
||||
//shared_ptr<StaticObjectMethod> AndroidUtil::StaticMethod_BookReadingException_throwForFile;
|
||||
|
||||
JNIEnv *AndroidUtil::getEnv() {
|
||||
JNIEnv *env;
|
||||
ourJavaVM->GetEnv((void **)&env, JNI_VERSION_1_2);
|
||||
|
@ -212,11 +210,6 @@ bool AndroidUtil::init(JavaVM* jvm) {
|
|||
Method_NativeBookModel_registerFontFamilyList = new VoidMethod(Class_NativeBookModel, "registerFontFamilyList", "([Ljava/lang/String;)");
|
||||
Method_NativeBookModel_registerFontEntry = new VoidMethod(Class_NativeBookModel, "registerFontEntry", "(Ljava/lang/String;Lorg/geometerplus/zlibrary/core/fonts/FileInfo;Lorg/geometerplus/zlibrary/core/fonts/FileInfo;Lorg/geometerplus/zlibrary/core/fonts/FileInfo;Lorg/geometerplus/zlibrary/core/fonts/FileInfo;)");
|
||||
|
||||
/*
|
||||
Class_BookReadingException = new JavaClass(env, "org/geometerplus/fbreader/bookmodel/BookReadingException");
|
||||
StaticMethod_BookReadingException_throwForFile = new StaticVoidMethod(Class_BookReadingException, "throwForFile", "(Ljava/lang/String;Lorg/geometerplus/zlibrary/core/filesystem/ZLFile;)V") );
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -330,24 +323,3 @@ jbyteArray AndroidUtil::createJavaByteArray(JNIEnv *env, const std::vector<jbyte
|
|||
env->SetByteArrayRegion(array, 0, size, &data.front());
|
||||
return array;
|
||||
}
|
||||
|
||||
void AndroidUtil::throwRuntimeException(const std::string &message) {
|
||||
getEnv()->ThrowNew(Class_java_lang_RuntimeException.j(), message.c_str());
|
||||
}
|
||||
|
||||
void AndroidUtil::throwCachedCharStorageException(const std::string &message) {
|
||||
getEnv()->ThrowNew(Class_CachedCharStorageException.j(), message.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
void AndroidUtil::throwBookReadingException(const std::string &resourceId, const ZLFile &file) {
|
||||
JNIEnv *env = getEnv();
|
||||
env->CallStaticVoidMethod(
|
||||
StaticMethod_BookReadingException_throwForFile,
|
||||
AndroidUtil::createJavaString(env, resourceId),
|
||||
AndroidUtil::createJavaFile(env, file.path())
|
||||
);
|
||||
// TODO: possible memory leak
|
||||
// TODO: clear ZLFile object reference
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue