mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 09:49:19 +02:00
exception throwing (in progress)
This commit is contained in:
parent
06660e99e2
commit
85f1714ddc
2 changed files with 12 additions and 3 deletions
|
@ -38,6 +38,7 @@ JavaClass AndroidUtil::Class_ZLibrary("org/geometerplus/zlibrary/core/library/ZL
|
|||
JavaClass AndroidUtil::Class_ZLFile("org/geometerplus/zlibrary/core/filesystem/ZLFile");
|
||||
JavaClass AndroidUtil::Class_ZLFileImage("org/geometerplus/zlibrary/core/image/ZLFileImage");
|
||||
JavaClass AndroidUtil::Class_ZLTextModel("org/geometerplus/zlibrary/text/model/ZLTextModel");
|
||||
JavaClass AndroidUtil::Class_CachedCharStorageException("org/geometerplus/zlibrary/text/model/CachedCharStorageException");
|
||||
|
||||
JavaClass AndroidUtil::Class_Encoding("org/geometerplus/zlibrary/core/encodings/Encoding");
|
||||
JavaClass AndroidUtil::Class_EncodingConverter("org/geometerplus/zlibrary/core/encodings/EncodingConverter");
|
||||
|
@ -273,8 +274,14 @@ jbyteArray AndroidUtil::createJavaByteArray(JNIEnv *env, const std::vector<jbyte
|
|||
return array;
|
||||
}
|
||||
|
||||
void AndroidUtil::throwRuntimeException(JNIEnv *env, const std::string &message) {
|
||||
env->ThrowNew(Class_java_lang_RuntimeException.j(), message.c_str());
|
||||
void AndroidUtil::throwRuntimeException(const std::string &message) {
|
||||
JNIEnv *env = getEnv();
|
||||
getEnv()->ThrowNew((jclass)env->NewLocalRef(Class_java_lang_RuntimeException.j()), message.c_str());
|
||||
}
|
||||
|
||||
void AndroidUtil::throwCachedCharStorageException(const std::string &message) {
|
||||
JNIEnv *env = getEnv();
|
||||
getEnv()->ThrowNew((jclass)env->NewLocalRef(Class_CachedCharStorageException.j()), message.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
static JavaClass Class_ZLFile;
|
||||
static JavaClass Class_ZLFileImage;
|
||||
static JavaClass Class_ZLTextModel;
|
||||
static JavaClass Class_CachedCharStorageException;
|
||||
static JavaClass Class_NativeFormatPlugin;
|
||||
static JavaClass Class_PluginCollection;
|
||||
static JavaClass Class_Encoding;
|
||||
|
@ -153,7 +154,8 @@ public:
|
|||
static jintArray createJavaIntArray(JNIEnv *env, const std::vector<jint> &data);
|
||||
static jbyteArray createJavaByteArray(JNIEnv *env, const std::vector<jbyte> &data);
|
||||
|
||||
static void throwRuntimeException(JNIEnv *env, const std::string &message);
|
||||
static void throwRuntimeException(const std::string &message);
|
||||
static void throwCachedCharStorageException(const std::string &message);
|
||||
//static void throwBookReadingException(const std::string &resourceId, const ZLFile &file);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue