diff options
author | Joachim Lingner <jl@openoffice.org> | 2004-05-07 13:49:41 +0000 |
---|---|---|
committer | Joachim Lingner <jl@openoffice.org> | 2004-05-07 13:49:41 +0000 |
commit | 5def523f04bea8fbb65ea83648040df1741bb8a6 (patch) | |
tree | a296afe3990be4705a51c068d64e83f5b6c5ee06 /jvmfwk/source | |
parent | b21347f0dce6d55c17a4f82946a9a092a1259a2a (diff) |
#i20052#
Diffstat (limited to 'jvmfwk/source')
-rw-r--r-- | jvmfwk/source/framework.cxx | 46 | ||||
-rw-r--r-- | jvmfwk/source/fwkutil.cxx | 7 |
2 files changed, 47 insertions, 6 deletions
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index ddaf79c68283..7db040eeb566 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -2,9 +2,9 @@ * * $RCSfile: framework.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: jl $ $Date: 2004-05-04 08:43:42 $ + * last change: $Author: jl $ $Date: 2004-05-07 14:49:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,6 +91,8 @@ namespace { JavaVM * g_pJavaVM = NULL; +bool g_bEnabledSwitchedOn = false; + sal_Bool areEqualJavaInfo( JavaInfo const * pInfoA,JavaInfo const * pInfoB) { @@ -316,6 +318,16 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti if (sVendorUpdate != javaSettings.getJavaInfoAttrVendorUpdate()) return JFW_E_INVALID_SETTINGS; + //check if JAVA is disabled + //If Java is enabled, but it was disabled when this process was started + // then no preparational work, such as setting the LD_LIBRARY_PATH, was + //done. Therefore if a JRE needs it it must not be started. + if (javaSettings.getEnabled() == sal_False) + return JFW_E_JAVA_DISABLED; + else if (g_bEnabledSwitchedOn && + (aInfo->nRequirements & JFW_REQUIRE_NEEDRESTART)) + return JFW_E_NEED_RESTART; + //Check if the selected Java was set in this process. If so it //must not have the requirments flag JFW_REQUIRE_NEEDRESTART if ((aInfo->nRequirements & JFW_REQUIRE_NEEDRESTART) @@ -411,7 +423,11 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti //start Java JavaVM *pVm = NULL; javaPluginError plerr = (*pFunc)(aInfo, arOpt, index, & pVm, ppEnv); - if (plerr != JFW_PLUGIN_E_NONE) + if (plerr == JFW_PLUGIN_E_VM_CREATION_FAILED) + { + errcode = JFW_E_VM_CREATION_FAILED; + } + else if (plerr != JFW_PLUGIN_E_NONE ) { errcode = JFW_E_ERROR; } @@ -420,7 +436,8 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti g_pJavaVM = pVm; *ppVM = pVm; } - return JFW_E_NONE; + OSL_ASSERT(plerr != JFW_PLUGIN_E_WRONG_VENDOR); + return errcode; } /** We do not use here jfw_findAllJREs and then check if a JavaInfo @@ -621,6 +638,8 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo) { //copy to out param *pInfo = aCurrentInfo.cloneJavaInfo(); + //remember that this JRE was selected in this process + jfw::setJavaSelected(); } } else @@ -800,6 +819,8 @@ javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo) errcode = node.writeSettings(); if (errcode != JFW_E_NONE) return errcode; + //remember that the JRE was selected in this process + jfw::setJavaSelected(); return errcode; } javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled) @@ -807,10 +828,27 @@ javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled) osl::MutexGuard guard(jfw::getFwkMutex()); javaFrameworkError errcode = JFW_E_NONE; jfw::CNodeJava node; + + if (g_bEnabledSwitchedOn == false && bEnabled == sal_True) + { + //When the process started then Enabled was false. + //This is first time enabled is set to true. + //That means, no preparational work has been done, such as setting the + //LD_LIBRARY_PATH, etc. + + //check if Enabled is false; + errcode = node.loadFromSettings(); + if (errcode != JFW_E_NONE) + return errcode; + if (node.getEnabled() == sal_False) + g_bEnabledSwitchedOn = true; + } node.setEnabled(bEnabled); errcode = node.writeSettings(); if (errcode != JFW_E_NONE) return errcode; + //remember if the enabled was false at the beginning and has + //been changed to true. return errcode; } diff --git a/jvmfwk/source/fwkutil.cxx b/jvmfwk/source/fwkutil.cxx index e9864ccaae09..fbb7099cf29d 100644 --- a/jvmfwk/source/fwkutil.cxx +++ b/jvmfwk/source/fwkutil.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fwkutil.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: jl $ $Date: 2004-04-28 09:11:38 $ + * last change: $Author: jl $ $Date: 2004-05-07 14:49:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,6 +89,7 @@ namespace jfw { bool g_bJavaSet = false; + struct Init { osl::Mutex * operator()() @@ -733,6 +734,8 @@ void setJavaSelected() g_bJavaSet = true; } + + /** Determines if the currently selected Java was set in this process. @see setProcessId() |