Skip to content

Commit

Permalink
Merge branch 'releases'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/pr.yml
#	CHANGELOG.md
#	packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/AppServicesClient.kt
#	packages/test-sync/src/commonMain/kotlin/io/realm/kotlin/test/mongodb/util/TestAppInitializer.kt
#	packages/test-sync/src/commonTest/kotlin/io/realm/kotlin/test/mongodb/common/SyncedRealmTests.kt
  • Loading branch information
clementetb committed Jul 8, 2024
2 parents fb796f0 + ec6f2a0 commit 9600dd1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ jobs:
path: ./packages/cinterop/build/realmLinuxBuild
key: jni-linux-lib-${{ needs.check-cache.outputs.packages-sha }}

- name: Setup Java 11
uses: actions/setup-java@v3
with:
distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }}
java-version: ${{ vars.VERSION_JAVA }}

- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2.0.2
with:
Expand All @@ -145,6 +151,8 @@ jobs:
-DREALM_NO_TESTS=1 \
-DREALM_BUILD_LIB_ONLY=true \
-DCMAKE_CXX_VISIBILITY_PRESET=hidden \
-DCMAKE_TOOLCHAIN_FILE=../../../external/core/tools/cmake/x86_64-linux-gnu.toolchain.cmake \
-DJAVA_INCLUDE_PATH=${{ env.JAVA_HOME }}/include/ \
../../src/jvm
make -j8
Expand Down Expand Up @@ -1142,7 +1150,9 @@ jobs:
always() &&
!cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
!contains(needs.*.result, 'cancelled') &&
endsWith(needs.check-cache.outputs.version-label, '-SNAPSHOT') &&
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases' || github.ref == 'refs/heads/release/k2')
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
* None.

### Fixed
* Fix crashes when core tries to log invalid utf-8 messages. (Issue [#1760](https://github.com/realm/realm-kotlin/issues/1760) [RKOTLIN-1089](https://jira.mongodb.org/browse/RKOTLIN-1089)).
* [Sync] Fatal sync exceptions are now thrown as `UnrecoverableSyncException`. (Issue [#1767](https://github.com/realm/realm-kotlin/issues/1767) [RKOTLIN-1096](https://jira.mongodb.org/browse/RKOTLIN-1096)).
* [Sync] Fix `NullPointerException` in `SubscriptionSet.waitForSynchronization`. (Issue [#1777](https://github.com/realm/realm-kotlin/issues/1777) [RKOTLIN-1102](https://jira.mongodb.org/browse/RKOTLIN-1102)).

Expand All @@ -59,6 +60,7 @@
### Internal
- None.


## 2.0.0 (2024-06-03)

> [!NOTE]
Expand Down
7 changes: 3 additions & 4 deletions packages/cinterop/src/jvm/jni/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,12 @@ static std::string string_to_hex(const std::string& message, realm::StringData&
ret << "error_code = " << error_code << "; ";
ret << "retcode = " << retcode << "; ";
ret << "StringData.size = " << str.size() << "; ";
ret << "StringData.data = " << str << "; ";
ret << "StringData as hex = ";
ret << "StringData as hex =";
for (std::string::size_type i = 0; i < str.size(); ++i)
ret << " 0x" << std::hex << std::setfill('0') << std::setw(2) << (int)s[i];
ret << "; ";
ret << "in_begin = " << in_begin << "; ";
ret << "in_end = " << in_end << "; ";
ret << "in_begin = " << (void*) in_begin << "; ";
ret << "in_end = " << (void*) in_end << "; ";
ret << "out_curr = " << out_curr << "; ";
ret << "out_end = " << out_end << ";";
return ret.str();
Expand Down
10 changes: 9 additions & 1 deletion packages/jni-swig-stub/src/main/jni/realm_api_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,15 @@ realm_set_log_callback([](void *userdata, const char *category, realm_log_level_
"(SLjava/lang/String;Ljava/lang/String;)V");

push_local_frame(jenv, 2);
jenv->CallVoidMethod(log_callback, log_method, java_level, to_jstring(jenv, category), to_jstring(jenv, message));
jstring j_message = NULL;
try {
j_message = to_jstring(jenv, message);
} catch (RuntimeError exception) {
std::ostringstream ret;
ret << "Invalid data: " << exception.reason();
j_message = to_jstring(jenv, ret.str());
}
jenv->CallVoidMethod(log_callback, log_method, java_level, to_jstring(jenv, category), j_message);
jni_check_exception(jenv);
jenv->PopLocalFrame(NULL);
},
Expand Down

0 comments on commit 9600dd1

Please sign in to comment.