From 1578cc5b61fe7d19a0c0bb478f3be52c0a8d9b5a Mon Sep 17 00:00:00 2001 From: "Keith W. Campbell" Date: Tue, 29 Aug 2023 17:51:52 -0400 Subject: [PATCH] Correct return type of JVM_LoadZipLibrary() Signed-off-by: Keith W. Campbell wip Signed-off-by: Keith W. Campbell Implement JVM_LoadZipLibrary() Signed-off-by: Keith W. Campbell --- runtime/j9vm/javanextvmi.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/runtime/j9vm/javanextvmi.cpp b/runtime/j9vm/javanextvmi.cpp index 73434f85627..b06eb62f633 100644 --- a/runtime/j9vm/javanextvmi.cpp +++ b/runtime/j9vm/javanextvmi.cpp @@ -223,8 +223,26 @@ JVM_ReportFinalizationComplete(JNIEnv *env, jobject obj) JNIEXPORT void * JNICALL JVM_LoadZipLibrary(void) { - Assert_SC_true(!"JVM_LoadZipLibrary unimplemented"); - return NULL; + void *zipHandle = NULL; + J9JavaVM *vm = BFUjavaVM; + + if (NULL != vm) { + PORT_ACCESS_FROM_JAVAVM(vm); + uintptr_t handle = 0; + + if (J9PORT_SL_FOUND == j9sl_open_shared_library( + (char *)"zip", + &handle, + OMRPORT_SLOPEN_DECORATE | OMRPORT_SLOPEN_LAZY) + ) { + zipHandle = (void *)handle; + } + } + + /* We may as well assert here: we won't make much progress without the library. */ + Assert_SC_notNull(zipHandle); + + return zipHandle; } JNIEXPORT void JNICALL