Compare commits

..

15 Commits
2.2.1 ... main

Author SHA1 Message Date
MohitMaliFtechiz
fc5151e23a
Merge pull request #118 from kiwix/release_2.2.4
Release `2.2.4`
2025-01-27 17:42:31 +05:30
MohitMaliFtechiz
4ac2217ea1 Updated the CHANGELOG file. 2025-01-27 17:37:31 +05:30
MohitMaliFtechiz
7421538036 Upgraded the java-libkiwix version to 2.2.4. 2025-01-27 17:37:31 +05:30
MohitMaliFtechiz
260f815f74 Release 2.2.3
* Upgraded the libkiwix version to `14.0.0-1`.
2025-01-27 17:37:31 +05:30
MohitMaliFtechiz
719a3106c4
Merge pull request #116 from kiwix/fix_native_crash_on_android
Fixed the native crash happening on Android.
2025-01-27 17:35:15 +05:30
MohitMaliFtechiz
d7c38990df Corrected the error message. 2025-01-27 16:34:41 +05:30
MohitMaliFtechiz
c5de943905 Fixed the native crash happening on Android.
* Improved the `getPtr` method to throw a `NativeHandleDisposedException` when a native object is `nullptr`, updated the `CATCH_EXCEPTION` macro to handle this exception by mapping it to `java.lang.IllegalStateException`, and ensured proper error handling to prevent crashes when accessing disposed objects.
2025-01-27 16:14:36 +05:30
MohitMaliFtechiz
4c6dadba84
Merge pull request #115 from kiwix/release_2.2.3
Release `2.2.3`
2024-10-14 18:44:11 +05:30
MohitMaliFtechiz
72b70aff67 Updated the CHANGELOG file, and corrected the minor issue in the CHANGELOG file. 2024-10-14 18:37:17 +05:30
MohitMaliFtechiz
6a60864ed1 Upgraded the java-libkiwix version to 2.2.3. 2024-10-14 18:30:16 +05:30
MohitMaliFtechiz
f1a91aa197 Upgraded the libkiwix, and libzim versions.
* Upgraded the libkiwix to `14.0.0`.
* Upgraded the libzim version to `9.2.3-2`.
2024-10-14 18:26:16 +05:30
Kelson
0d0f67b908
Merge pull request #113 from kiwix/release-2.2.2
Release 2.2.2
2024-08-29 11:43:47 +00:00
Emmanuel Engelhart
dfc473e1f2
Add changelog for 2.2.2 2024-08-29 13:35:12 +02:00
Emmanuel Engelhart
02577714ff
use libzim 9.2.3-1 2024-08-29 13:29:57 +02:00
Emmanuel Engelhart
4a20fb8485
Bump-up version to 2.2.2 2024-08-29 13:28:04 +02:00
4 changed files with 25 additions and 3 deletions

View File

@ -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)

View File

@ -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 {

View File

@ -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; \

View File

@ -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)