mirror of
https://github.com/kiwix/java-libkiwix.git
synced 2025-09-23 20:10:56 -04:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fc5151e23a | ||
![]() |
4ac2217ea1 | ||
![]() |
7421538036 | ||
![]() |
260f815f74 | ||
![]() |
719a3106c4 | ||
![]() |
d7c38990df | ||
![]() |
c5de943905 | ||
![]() |
4c6dadba84 | ||
![]() |
72b70aff67 | ||
![]() |
6a60864ed1 | ||
![]() |
f1a91aa197 | ||
![]() |
0d0f67b908 | ||
![]() |
dfc473e1f2 | ||
![]() |
02577714ff | ||
![]() |
4a20fb8485 |
11
CHANGELOG
11
CHANGELOG
@ -1,3 +1,14 @@
|
||||
2.2.4
|
||||
* NEW: Use libkiwix 14.0.0-1 (@MohitMaliFtechiz https://github.com/kiwix/java-libkiwix/pull/118)
|
||||
* FIX: Native crashes on Android (@MohitMaliFtechiz, @mgautierfr https://github.com/kiwix/java-libkiwix/pull/116)
|
||||
|
||||
2.2.3
|
||||
* NEW: Use libzim 9.2.3-2 (@MohitMaliFtechiz https://github.com/kiwix/java-libkiwix/pull/115)
|
||||
* NEW: Use libkiwix 14.0.0 (@MohitMaliFtechiz https://github.com/kiwix/java-libkiwix/pull/115)
|
||||
|
||||
2.2.2
|
||||
* NEW: Use libzim 9.2.3 (@kelson42 https://github.com/kiwix/java-libkiwix/pull/113)
|
||||
|
||||
2.2.1
|
||||
* NEW: Use libzim 9.2.2 (@kelson42 https://github.com/kiwix/java-libkiwix/pull/108)
|
||||
|
||||
|
@ -19,12 +19,12 @@ ext["sonatypeStagingProfileId"] = properties.getProperty("sonatypeStagingProfile
|
||||
ext {
|
||||
set("GROUP_ID", "org.kiwix")
|
||||
set("ARTIFACT_ID", "libkiwix")
|
||||
set("VERSION", "2.2.1")
|
||||
set("VERSION", "2.2.4")
|
||||
}
|
||||
|
||||
// Replace these versions with the latest available versions of libkiwix and libzim
|
||||
ext.libkiwix_version = "13.1.0-4"
|
||||
ext.libzim_version = "9.2.2"
|
||||
ext.libkiwix_version = "14.0.0-1"
|
||||
ext.libzim_version = "9.2.3-2"
|
||||
|
||||
apply from: 'publish.gradle'
|
||||
android {
|
||||
|
@ -53,6 +53,9 @@ catch(const zim::ZimFileFormatError& e) { \
|
||||
} catch(const zim::EntryNotFound& e) { \
|
||||
throwException(env, "org/kiwix/libzim/EntryNotFoundException", e.what()); \
|
||||
return RET; \
|
||||
} catch (const NativeHandleDisposedException& e) { \
|
||||
throwException(env, "java/lang/IllegalStateException", e.what()); \
|
||||
return RET; \
|
||||
} catch (const std::ios_base::failure& e) { \
|
||||
throwException(env, "java/io/IOException", e.what()); \
|
||||
return RET; \
|
||||
|
@ -96,6 +96,11 @@ inline void setHandle(JNIEnv* env, jobject thisObj, Args && ...args)
|
||||
}
|
||||
#define SET_HANDLE(NATIVE_TYPE, OBJ, VALUE) setHandle<NATIVE_TYPE>(env, OBJ, VALUE)
|
||||
|
||||
class NativeHandleDisposedException : public std::runtime_error {
|
||||
public:
|
||||
explicit NativeHandleDisposedException(const std::string& message)
|
||||
: std::runtime_error(message) {}
|
||||
};
|
||||
|
||||
// Return a shared_ptr for the handle
|
||||
template<typename T>
|
||||
@ -104,6 +109,9 @@ shared_ptr<T> getPtr(JNIEnv* env, jobject thisObj, const char* handleName = "nat
|
||||
jclass thisClass = env->GetObjectClass(thisObj);
|
||||
jfieldID fidNumber = env->GetFieldID(thisClass, handleName, "J");
|
||||
auto handle = reinterpret_cast<shared_ptr<T>*>(env->GetLongField(thisObj, fidNumber));
|
||||
if (handle == nullptr) {
|
||||
throw NativeHandleDisposedException("The native object has already been disposed");
|
||||
}
|
||||
return *handle;
|
||||
}
|
||||
#define GET_PTR(NATIVE_TYPE) getPtr<NATIVE_TYPE>(env, thisObj)
|
||||
|
Loading…
x
Reference in New Issue
Block a user