[Libreoffice-commits] core.git: cui/source include/jvmfwk jvmfwk/source

Stephan Bergmann sbergman at redhat.com
Tue Apr 11 16:33:57 UTC 2017


 cui/source/options/optjava.cxx |   20 +++-----------------
 include/jvmfwk/framework.hxx   |    9 ++-------
 jvmfwk/source/framework.cxx    |   10 ++--------
 3 files changed, 7 insertions(+), 32 deletions(-)

New commits:
commit 33cf2b6613da36863f6f64a7ac1e413ac1e641ff
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Apr 11 18:33:31 2017 +0200

    Let jfw_isVMRunning return the result; there are no error conditions
    
    Change-Id: I004b3d6f6b7b32d1bb41072d7fdd4a66f944d992

diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 4dda48d41627..843fc2e5eb52 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -323,12 +323,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl, Button*, void)
         if ( !areListsEqual( aParameterList, m_pParamDlg->GetParameters() ) )
         {
             aParameterList = m_pParamDlg->GetParameters();
-            bool bRunning = false;
-            javaFrameworkError eErr = jfw_isVMRunning( &bRunning );
-            DBG_ASSERT( JFW_E_NONE == eErr,
-                        "SvxJavaOptionsPage::ParameterHdl_Impl(): error in jfw_isVMRunning" );
-            (void)eErr;
-            if ( bRunning )
+            if ( jfw_isVMRunning() )
             {
                 SolarMutexGuard aGuard;
                 svtools::executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, svtools::RESTART_REASON_ASSIGNING_JAVAPARAMETERS);
@@ -368,12 +363,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl, Button*, void)
         if ( m_pPathDlg->GetClassPath() != sClassPath )
         {
             sClassPath = m_pPathDlg->GetClassPath();
-            bool bRunning = false;
-            javaFrameworkError eErr = jfw_isVMRunning( &bRunning );
-            DBG_ASSERT( JFW_E_NONE == eErr,
-                        "SvxJavaOptionsPage::ParameterHdl_Impl(): error in jfw_isVMRunning" );
-            (void)eErr;
-            if ( bRunning )
+            if ( jfw_isVMRunning() )
             {
                 SolarMutexGuard aGuard;
                 svtools::executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, svtools::RESTART_REASON_ASSIGNING_FOLDERS);
@@ -683,11 +673,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
             {
                 if (!pSelectedJava || !jfw_areEqualJavaInfo( pInfo, pSelectedJava.get() ) )
                 {
-                    bool bRunning = false;
-                    eErr = jfw_isVMRunning( &bRunning );
-                    DBG_ASSERT( JFW_E_NONE == eErr,
-                                "SvxJavaOptionsPage::FillItemSet(): error in jfw_isVMRunning" );
-                    if ( bRunning ||
+                    if ( jfw_isVMRunning() ||
                         ( ( pInfo->nRequirements & JFW_REQUIRE_NEEDRESTART ) == JFW_REQUIRE_NEEDRESTART ) )
                     {
                         svtools::executeRestartDialog(
diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index e941b9a9f2fc..d212ed224455 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -295,15 +295,10 @@ JVMFWK_DLLPUBLIC bool jfw_areEqualJavaInfo(
     By determining if a VM is running, the user can be presented a message,
     that the changed setting may not be effective immediately.</p>
 
-    @param bRunning
-    [out] true - a VM is running. <br/>
-    false - no VM is running.
-
     @return
-    JFW_E_NONE function ran successfully.<br/>
-    JFW_E_INVALID_ARG the parameter <code>bRunning</code> was NULL.
+    true iff a VM is running.
 */
-JVMFWK_DLLPUBLIC javaFrameworkError jfw_isVMRunning(bool *bRunning);
+JVMFWK_DLLPUBLIC bool jfw_isVMRunning();
 
 /** detects a suitable JRE and configures the framework to use it.
 
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 8447d320aae6..751068cabf0e 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -684,16 +684,10 @@ javaFrameworkError jfw_getSelectedJRE(std::unique_ptr<JavaInfo> *ppInfo)
     return errcode;
 }
 
-javaFrameworkError jfw_isVMRunning(bool *bRunning)
+bool jfw_isVMRunning()
 {
     osl::MutexGuard guard(jfw::FwkMutex::get());
-    if (bRunning == nullptr)
-        return JFW_E_INVALID_ARG;
-    if (g_pJavaVM == nullptr)
-        *bRunning = false;
-    else
-        *bRunning = true;
-    return JFW_E_NONE;
+    return g_pJavaVM != nullptr;
 }
 
 javaFrameworkError jfw_getJavaInfoByPath(rtl_uString *pPath, std::unique_ptr<JavaInfo> *ppInfo)


More information about the Libreoffice-commits mailing list