[Libreoffice-commits] .: 7 commits - jvmfwk/inc jvmfwk/plugins jvmfwk/source

Jan Holesovsky kendy at kemper.freedesktop.org
Mon Nov 1 08:35:40 PDT 2010


 jvmfwk/inc/jvmfwk/framework.h                       |    1 
 jvmfwk/inc/jvmfwk/vendorplugin.h                    |   19 ++++++
 jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx      |    5 -
 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx |   62 +++++++++++++++++++-
 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map |    5 +
 jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx    |    4 -
 jvmfwk/plugins/sunmajor/pluginlib/util.cxx          |    8 +-
 jvmfwk/source/elements.cxx                          |   10 +++
 jvmfwk/source/framework.cxx                         |   48 +++++++++------
 jvmfwk/source/framework.hxx                         |    4 +
 10 files changed, 136 insertions(+), 30 deletions(-)

New commits:
commit 9eaabc678b00eb630b521ea82be163b9ee8e19f8
Merge: 9315f8b... eef9cb6...
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Nov 1 16:34:53 2010 +0100

    Merge branch 'master' of ssh://git.freedesktop.org/git/libreoffice/ure

commit 9315f8bc6eeeaaeec75d528f02a0ee7b7670edda
Merge: da17994... 77f4315...
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Nov 1 13:54:58 2010 +0100

    Merge commit 'ooo/OOO330_m13'

diff --cc jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 10d2ce2,23a380c..1ff9766
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@@ -615,6 -614,63 +615,64 @@@ javaPluginError jfw_plugin_startJavaVir
     return errcode;
  }
  
+ extern "C"
+ javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
+ {
+     javaPluginError ret = JFW_PLUGIN_E_NONE;
+     if (!pInfo || !exist)
+         return JFW_PLUGIN_E_INVALID_ARG;
+     ::rtl::OUString sLocation(pInfo->sLocation);
+ 
+     if (sLocation.getLength() == 0)
+         return JFW_PLUGIN_E_INVALID_ARG;
+     ::osl::DirectoryItem item;
+     ::osl::File::RC rc_item = ::osl::DirectoryItem::get(sLocation, item);
+     if (::osl::File::E_None == rc_item)
+     {
+         *exist = sal_True;
+     }
+     else if (::osl::File::E_NOENT == rc_item)
+     {
+         *exist = sal_False;
+     }
+     else
+     {
+         ret = JFW_PLUGIN_E_ERROR;
+     }
+ #ifdef MACOSX
+     //We can have the situation that the JavaVM runtime library is not
+     //contained within JAVA_HOME. Then the check for JAVA_HOME would return
+     //true although the runtime library may not be loadable.
+     if (ret == JFW_PLUGIN_E_NONE && *exist == sal_True)
+     {
+         rtl::OUString sRuntimeLib = getRuntimeLib(pInfo->arVendorData);
+         JFW_TRACE2(OUSTR("[Java framework] Checking existence of Java runtime library.\n"));
+      
+         ::osl::DirectoryItem itemRt;
+         ::osl::File::RC rc_itemRt = ::osl::DirectoryItem::get(sRuntimeLib, itemRt);
+         if (::osl::File::E_None == rc_itemRt)
+         {
+             *exist = sal_True;
+             JFW_TRACE2(OUSTR("[Java framework] Java runtime library exist: ")
+               + sRuntimeLib + OUSTR("\n"));
+ 
+         }
+         else if (::osl::File::E_NOENT == rc_itemRt)
+         {
+             *exist = sal_False;
+             JFW_TRACE2(OUSTR("[Java framework] Java runtime library does not exist: ")
+                        + sRuntimeLib + OUSTR("\n"));
+         }
+         else
+         {
+             ret = JFW_PLUGIN_E_ERROR;
+             JFW_TRACE2(OUSTR("[Java framework] Error while looking for Java runtime library: ")
+                        + sRuntimeLib + OUSTR(" \n"));
+         }
+     }
+ #endif
+     return ret;
+ }
  
  
 +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 77f431550648efb97a6d22eeea5009a69fcdef34
Merge: b2f9f93... d3c7714...
Author: obo <obo at openoffice.org>
Date:   Thu Oct 28 10:51:46 2010 +0200

    CWS-TOOLING: integrate CWS jl162

commit d3c7714e15ee5e048e24555af324381a0de6cb23
Author: Joachim Lingner <jl at openoffice.org>
Date:   Wed Oct 27 14:33:45 2010 +0200

    jl162 #i115180# fix problems with latest java 1.6.0_22 on MacOS 10.6

diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 1b14f97..9a2d8a4 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -938,8 +938,7 @@ void CNodeJavaInfo::loadFromNode(xmlDoc * pDoc, xmlNode * pJavaInfo)
             //nRequirements does not have the flag JFW_REQUIRE_NEEDRESTART the
             //jvm of the new selected JRE will be started. Old settings (before
             //OOo 3.3) still contain the flag which can be safely ignored.
-            if (nRequirements & JFW_REQUIRE_NEEDRESTART)
-                nRequirements ^= JFW_REQUIRE_NEEDRESTART;
+            nRequirements &= ~JFW_REQUIRE_NEEDRESTART;
 #endif            
         }
         else if (xmlStrcmp(cur->name, (xmlChar*) "vendorData") == 0)
commit 03a26afa7cefcc99ebfce60050581cd9adf5822f
Author: Joachim Lingner <jl at openoffice.org>
Date:   Wed Oct 27 13:53:26 2010 +0200

    jl162 #i115180# fix problems with latest java 1.6.0_22 on MacOS 10.6

diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index c2474e5..1b14f97 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -938,7 +938,8 @@ void CNodeJavaInfo::loadFromNode(xmlDoc * pDoc, xmlNode * pJavaInfo)
             //nRequirements does not have the flag JFW_REQUIRE_NEEDRESTART the
             //jvm of the new selected JRE will be started. Old settings (before
             //OOo 3.3) still contain the flag which can be safely ignored.
-            nRequirements ^= JFW_REQUIRE_NEEDRESTART;
+            if (nRequirements & JFW_REQUIRE_NEEDRESTART)
+                nRequirements ^= JFW_REQUIRE_NEEDRESTART;
 #endif            
         }
         else if (xmlStrcmp(cur->name, (xmlChar*) "vendorData") == 0)
commit 33b3fb4a005f9822b3a3547db3395c816fb870c0
Author: Joachim Lingner <jl at openoffice.org>
Date:   Tue Oct 26 12:28:33 2010 +0200

    jl162 #i115180# fix problems with latest java 1.6.0_22 on MacOS 10.6

diff --git a/jvmfwk/inc/jvmfwk/framework.h b/jvmfwk/inc/jvmfwk/framework.h
index 00c2b0f..30e5bdc 100644
--- a/jvmfwk/inc/jvmfwk/framework.h
+++ b/jvmfwk/inc/jvmfwk/framework.h
@@ -830,6 +830,7 @@ javaFrameworkError SAL_CALL jfw_getJRELocations(
     JFW_E_NONE the function ran successfully.</br>
     JFW_E_ERROR an error occurred during execution.</br>
     JFW_E_INVALID_ARG pInfo contains invalid data</br>
+    JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
  */
 javaFrameworkError SAL_CALL jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
 
diff --git a/jvmfwk/inc/jvmfwk/vendorplugin.h b/jvmfwk/inc/jvmfwk/vendorplugin.h
index 3df1a98..7844ee4 100644
--- a/jvmfwk/inc/jvmfwk/vendorplugin.h
+++ b/jvmfwk/inc/jvmfwk/vendorplugin.h
@@ -238,6 +238,25 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
 
 
 
+/** checks if the installation of the jre still exists.
+
+    This function checks if the JRE described by pInfo still
+    exists. The check must be very quick because it is called by javaldx
+    (Linux, Solaris) at start up.
+
+    @param pInfo
+        [in]  the JavaInfo object with information about the JRE.
+    @param pp_exist
+        [out] the parameter is set to either sal_True or sal_False. The value is
+        only valid if the function returns JFW_E_NONE.
+    
+   @return
+    JFW_PLUGIN_E_NONE the function ran successfully.</br>
+    JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
+    JFW_PLUGIN_E_INVALID_ARG pInfo contains invalid data</br>
+ */
+javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx
index 4a607a0..c21fbff 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx
@@ -73,7 +73,6 @@ char const* const* OtherInfo::getRuntimePaths(int * size)
         "/bin/hotspot/jvm.dll"
 #elif UNX
 #ifdef MACOSX
-        "/../../../JavaVM",
         "/../../../../../Frameworks/JavaVM.framework/JavaVM"  //as of  1.6.0_22
 #else
         "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so", // for Blackdown PPC
@@ -96,8 +95,7 @@ char const* const* OtherInfo::getLibraryPaths(int* size)
 #ifdef UNX        
     static char const * ar[] = {
 #ifdef MACOSX
-        "/../Libraries",
-        "/lib"
+        //mac version does not have a ld library path anymore
 #else
         "/bin",
         "/jre/bin",
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 1165e50..23a380c 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -470,10 +470,10 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
      {
          JFW_ENSURE(0, OUSTR("[Java framework]sunjavaplugin" SAL_DLLEXTENSION
                              " could not load Java runtime library: \n")
-                    + sRuntimeLib + OUSTR("."));
+                    + sRuntimeLib + OUSTR("\n"));
          JFW_TRACE0(OUSTR("[Java framework]sunjavaplugin" SAL_DLLEXTENSION
                              " could not load Java runtime library: \n")
-                    + sRuntimeLib +  OUSTR("."));
+                    + sRuntimeLib +  OUSTR("\n"));
          return JFW_PLUGIN_E_VM_CREATION_FAILED;
      }
 
@@ -614,5 +614,63 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
    return errcode;
 }
 
+extern "C"
+javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
+{
+    javaPluginError ret = JFW_PLUGIN_E_NONE;
+    if (!pInfo || !exist)
+        return JFW_PLUGIN_E_INVALID_ARG;
+    ::rtl::OUString sLocation(pInfo->sLocation);
+
+    if (sLocation.getLength() == 0)
+        return JFW_PLUGIN_E_INVALID_ARG;
+    ::osl::DirectoryItem item;
+    ::osl::File::RC rc_item = ::osl::DirectoryItem::get(sLocation, item);
+    if (::osl::File::E_None == rc_item)
+    {
+        *exist = sal_True;
+    }
+    else if (::osl::File::E_NOENT == rc_item)
+    {
+        *exist = sal_False;
+    }
+    else
+    {
+        ret = JFW_PLUGIN_E_ERROR;
+    }
+#ifdef MACOSX
+    //We can have the situation that the JavaVM runtime library is not
+    //contained within JAVA_HOME. Then the check for JAVA_HOME would return
+    //true although the runtime library may not be loadable.
+    if (ret == JFW_PLUGIN_E_NONE && *exist == sal_True)
+    {
+        rtl::OUString sRuntimeLib = getRuntimeLib(pInfo->arVendorData);
+        JFW_TRACE2(OUSTR("[Java framework] Checking existence of Java runtime library.\n"));
+     
+        ::osl::DirectoryItem itemRt;
+        ::osl::File::RC rc_itemRt = ::osl::DirectoryItem::get(sRuntimeLib, itemRt);
+        if (::osl::File::E_None == rc_itemRt)
+        {
+            *exist = sal_True;
+            JFW_TRACE2(OUSTR("[Java framework] Java runtime library exist: ")
+              + sRuntimeLib + OUSTR("\n"));
+
+        }
+        else if (::osl::File::E_NOENT == rc_itemRt)
+        {
+            *exist = sal_False;
+            JFW_TRACE2(OUSTR("[Java framework] Java runtime library does not exist: ")
+                       + sRuntimeLib + OUSTR("\n"));
+        }
+        else
+        {
+            ret = JFW_PLUGIN_E_ERROR;
+            JFW_TRACE2(OUSTR("[Java framework] Error while looking for Java runtime library: ")
+                       + sRuntimeLib + OUSTR(" \n"));
+        }
+    }
+#endif
+    return ret;
+}
 
 
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map
index db75c96..c08817d 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map
@@ -6,3 +6,8 @@ UDK_3_0_0 {
     local:
     *;
 };
+
+UDK_3.1 { # OOo 3.3
+    global:
+    jfw_plugin_existJRE;	
+} UDK_3_0_0;
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
index 215e1f0..4190077 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
@@ -418,9 +418,9 @@ SelfTest::SelfTest()
             break;
     }
     if (bRet)
-        JFW_TRACE2("[Java framework] sunjavaplugin: Testing class SunVersion succeeded.");
+        JFW_TRACE2("[Java framework] sunjavaplugin: Testing class SunVersion succeeded.\n");
     else
-        OSL_ENSURE(bRet, "[Java framework] sunjavaplugin: SunVersion self test failed");
+        OSL_ENSURE(bRet, "[Java framework] sunjavaplugin: SunVersion self test failed.\n");
 }
 #endif
 
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index 4ae83e5..b0c94c4 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -450,12 +450,12 @@ bool getJavaProps(const OUString & exePath,
         rs = stdoutReader.readLine( & aLine);
         if (rs != FileHandleReader::RESULT_OK)
             break;
-        JFW_TRACE2(OString("[Java framework] line:\" ")
-               + aLine + OString(" \".\n"));
+//         JFW_TRACE2(OString("[Java framework] line:\" ")
+//                + aLine + OString(" \".\n"));
         OUString sLine;
         if (!decodeOutput(aLine, &sLine))
             continue;
-        JFW_TRACE2(OString("[Java framework] line:\" ")
+        JFW_TRACE2(OString("[Java framework]:\" ")
                + OString( CHAR_POINTER(sLine)) + OString(" \".\n"));
         sLine = sLine.trim();
         if (sLine.getLength() == 0)
@@ -509,7 +509,7 @@ bool decodeOutput(const rtl::OString& s, rtl::OUString* out)
     } while (nIndex >= 0);
 
     *out = buff.makeStringAndClear();
-    JFW_TRACE2(*out);
+//    JFW_TRACE2(*out);
     return true;
 }
 
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 0d14a39..c2474e5 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -930,6 +930,16 @@ void CNodeJavaInfo::loadFromNode(xmlDoc * pDoc, xmlNode * pJavaInfo)
                 pDoc, cur->children, 1);
             rtl::OUString sRequire = xmlRequire;
             nRequirements = sRequire.toInt64(16);
+#ifdef MACOSX
+            //javaldx is not used anymore in the mac build. In case the Java
+            //corresponding to the saved settings does not exist anymore the
+            //javavm services will look for an existing Java after creation of
+            //the JVM failed. See stoc/source/javavm/javavm.cxx. Only if
+            //nRequirements does not have the flag JFW_REQUIRE_NEEDRESTART the
+            //jvm of the new selected JRE will be started. Old settings (before
+            //OOo 3.3) still contain the flag which can be safely ignored.
+            nRequirements ^= JFW_REQUIRE_NEEDRESTART;
+#endif            
         }
         else if (xmlStrcmp(cur->name, (xmlChar*) "vendorData") == 0)
         {
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index ee8378e..1f9bb76 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -1114,29 +1114,39 @@ javaFrameworkError SAL_CALL jfw_getJRELocations(
 
 javaFrameworkError jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
 {
-    javaFrameworkError ret = JFW_E_NONE;
-    if (!pInfo || !exist)
-        return JFW_E_INVALID_ARG;
-    ::rtl::OUString sLocation(pInfo->sLocation);
-
-    if (sLocation.getLength() == 0)
-        return JFW_E_INVALID_ARG;
+    //get the function jfw_plugin_existJRE
+    jfw::VendorSettings aVendorSettings;
+    jfw::CJavaInfo aInfo;
+    aInfo = (const ::JavaInfo*) pInfo; //makes a copy of pInfo
+    rtl::OUString sLibPath = aVendorSettings.getPluginLibrary(aInfo.getVendor());
+    osl::Module modulePlugin(sLibPath);
+    if ( ! modulePlugin)
+        return JFW_E_NO_PLUGIN;
+    rtl::OUString sFunctionName(
+        RTL_CONSTASCII_USTRINGPARAM("jfw_plugin_existJRE"));
+    jfw_plugin_existJRE_ptr pFunc =
+        (jfw_plugin_existJRE_ptr)
+        osl_getFunctionSymbol(modulePlugin, sFunctionName.pData);
+    if (pFunc == NULL)
+        return JFW_E_ERROR;
+
+    javaPluginError plerr = (*pFunc)(pInfo, exist);
 
-    ::osl::DirectoryItem item;
-    ::osl::File::RC rc_item = ::osl::DirectoryItem::get(sLocation, item);
-    if (::osl::File::E_None == rc_item)
-    {
-        *exist = sal_True;
-    }
-    else if (::osl::File::E_NOENT == rc_item)
-    {
-        *exist = sal_False;
-    }
-    else
+    javaFrameworkError ret = JFW_E_NONE;
+    switch (plerr)
     {
+    case JFW_PLUGIN_E_NONE:
+        ret = JFW_E_NONE;
+        break;
+    case JFW_PLUGIN_E_INVALID_ARG:
+        ret = JFW_E_INVALID_ARG;
+        break;
+    case JFW_PLUGIN_E_ERROR:
+        ret = JFW_E_ERROR;
+        break;
+    default:
         ret = JFW_E_ERROR;
     }
-
     return ret;
 }
 
diff --git a/jvmfwk/source/framework.hxx b/jvmfwk/source/framework.hxx
index 740c523..91a3aa2 100644
--- a/jvmfwk/source/framework.hxx
+++ b/jvmfwk/source/framework.hxx
@@ -64,6 +64,10 @@ typedef javaPluginError (*jfw_plugin_startJavaVirtualMachine_ptr)(
     JavaVM ** ppVM,
     JNIEnv ** ppEnv);
 
+typedef javaPluginError (*jfw_plugin_existJRE_ptr)(
+    const JavaInfo *info, 
+    sal_Bool *exist);
+
 
 namespace jfw
 {
commit 06a5ed97b8ccff99b13cee8a101881b10216fba1
Author: Joachim Lingner <jl at openoffice.org>
Date:   Thu Oct 21 16:14:09 2010 +0200

    jl162 #i115180# OOo does not find VM runtime library of Java 1.6.0_22 on Mac

diff --git a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx
index 352c13c..4a607a0 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx
@@ -73,7 +73,8 @@ char const* const* OtherInfo::getRuntimePaths(int * size)
         "/bin/hotspot/jvm.dll"
 #elif UNX
 #ifdef MACOSX
-        "/../../../JavaVM"
+        "/../../../JavaVM",
+        "/../../../../../Frameworks/JavaVM.framework/JavaVM"  //as of  1.6.0_22
 #else
         "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so", // for Blackdown PPC
         "/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so", // for Blackdown AMD64


More information about the Libreoffice-commits mailing list