Kaydet (Commit) 298b14e2 authored tarafından Stephan Bergmann's avatar Stephan Bergmann Kaydeden (comit) Andras Timar

Don't pass empty option to JNI_CreateJavaVM

sUserClassPath may be empty (instead of containing "-Djava.class.path=...")
here, which older versions of Java have apparently silently ignored.  But
Java 10 now fails with JNI_EINVAL (-6).  (Happens e.g. during
CppunitTest_dbaccess_hsqldb_test.)

Change-Id: Ifd13222f0d0ae69547bd1a9fe0fd5eae47917d0a
Reviewed-on: https://gerrit.libreoffice.org/51949Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 19d2ec65)
Reviewed-on: https://gerrit.libreoffice.org/51977Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
(cherry picked from commit 9a335d04)
üst 49b834a1
......@@ -247,22 +247,27 @@ javaFrameworkError jfw_startVM(
// it contains the classpath and all options set in the
//options dialog
std::unique_ptr<JavaVMOption[]> sarJOptions(
new JavaVMOption[arOptions.size() + 2 + vmParams.size()]);
new JavaVMOption[
arOptions.size() + (sUserClassPath.isEmpty() ? 1 : 2) + vmParams.size()]);
JavaVMOption * arOpt = sarJOptions.get();
if (! arOpt)
return JFW_E_ERROR;
//The first argument is the classpath
arOpt[0].optionString= const_cast<char*>(sUserClassPath.getStr());
arOpt[0].extraInfo = nullptr;
int index = 0;
if (!sUserClassPath.isEmpty()) {
arOpt[index].optionString= const_cast<char*>(sUserClassPath.getStr());
arOpt[index].extraInfo = nullptr;
++index;
}
// Set a flag that this JVM has been created via the JNI Invocation API
// (used, for example, by UNO remote bridges to share a common thread pool
// factory among Java and native bridge implementations):
arOpt[1].optionString = const_cast<char *>("-Dorg.openoffice.native=");
arOpt[1].extraInfo = nullptr;
arOpt[index].optionString = const_cast<char *>("-Dorg.openoffice.native=");
arOpt[index].extraInfo = nullptr;
++index;
//add the options set by options dialog
int index = 2;
for (auto const & vmParam : vmParams)
{
arOpt[index].optionString = const_cast<sal_Char*>(vmParam.getStr());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment