diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-02 16:25:40 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-02 16:25:40 +0000 |
commit | 1f1f32319ba54ef3debef3f7137c74c1c7056de4 (patch) | |
tree | 1b839b955b4e924e5a4419b04906be20c9f46c07 | |
parent | dc5af79e0098a8b20cdb6299d8190408c134be65 (diff) |
CWS-TOOLING: integrate CWS jl119_DEV300
2009-03-13 08:14:58 +0100 jl r269453 : CWS-TOOLING: rebase CWS jl119 to branches/OOO310@269350 (milestone: OOO310:m5)
2009-03-10 16:01:33 +0100 jl r269280 : #i98990# apply patch by jbu: fixing the python script provider
2009-03-10 13:25:02 +0100 jl r269268 : #i93939#
2009-03-10 11:44:07 +0100 jl r269261 : #i93939#
2009-03-09 17:14:58 +0100 jl r269205 : #i93939# choose a different JRE when the selected one was uninstalled
2009-03-09 16:34:34 +0100 jl r269201 : #i93939# choose a different JRE when the selected one was uninstalled
2009-03-05 16:40:16 +0100 jl r268924 : #99618# Do not migrate java settings
2009-02-25 14:29:53 +0100 jl r268439 : #i99618# do not invalidate existing javasettings by using a new date in the update element
-rw-r--r-- | jvmfwk/distributions/OpenOfficeorg/javavendors_linux.xml | 2 | ||||
-rw-r--r-- | jvmfwk/distributions/OpenOfficeorg/javavendors_macosx.xml | 2 | ||||
-rw-r--r-- | jvmfwk/distributions/OpenOfficeorg/javavendors_os2.xml | 2 | ||||
-rwxr-xr-x | jvmfwk/distributions/OpenOfficeorg/javavendors_unx.xml | 4 | ||||
-rw-r--r-- | jvmfwk/distributions/OpenOfficeorg/javavendors_wnt.xml | 2 | ||||
-rw-r--r-- | jvmfwk/inc/jvmfwk/framework.h | 21 | ||||
-rwxr-xr-x | jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx | 40 | ||||
-rw-r--r-- | jvmfwk/source/framework.cxx | 30 | ||||
-rw-r--r-- | jvmfwk/source/framework.map | 5 | ||||
-rw-r--r-- | stoc/source/javavm/javavm.cxx | 33 |
10 files changed, 121 insertions, 20 deletions
diff --git a/jvmfwk/distributions/OpenOfficeorg/javavendors_linux.xml b/jvmfwk/distributions/OpenOfficeorg/javavendors_linux.xml index 1a80a96d7..242219546 100644 --- a/jvmfwk/distributions/OpenOfficeorg/javavendors_linux.xml +++ b/jvmfwk/distributions/OpenOfficeorg/javavendors_linux.xml @@ -3,7 +3,7 @@ <javaSelection xmlns="http://openoffice.org/2004/java/framework/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <updated>2008-01-16</updated> + <updated>2004-01-30</updated> <vendorInfos> <vendor name="Sun Microsystems Inc."> diff --git a/jvmfwk/distributions/OpenOfficeorg/javavendors_macosx.xml b/jvmfwk/distributions/OpenOfficeorg/javavendors_macosx.xml index 1d7894a11..215d26c0e 100644 --- a/jvmfwk/distributions/OpenOfficeorg/javavendors_macosx.xml +++ b/jvmfwk/distributions/OpenOfficeorg/javavendors_macosx.xml @@ -3,7 +3,7 @@ <javaSelection xmlns="http://openoffice.org/2004/java/framework/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <updated>2008-01-16</updated> + <updated>2006-05-02</updated> <vendorInfos> <vendor name="Apple Computer, Inc."> diff --git a/jvmfwk/distributions/OpenOfficeorg/javavendors_os2.xml b/jvmfwk/distributions/OpenOfficeorg/javavendors_os2.xml index 5a499405c..0d0ff56b6 100644 --- a/jvmfwk/distributions/OpenOfficeorg/javavendors_os2.xml +++ b/jvmfwk/distributions/OpenOfficeorg/javavendors_os2.xml @@ -3,7 +3,7 @@ <javaSelection xmlns="http://openoffice.org/2004/java/framework/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <updated>2008-01-16</updated> + <updated>2004-01-30</updated> <vendorInfos> <vendor name="Sun Microsystems Inc."> diff --git a/jvmfwk/distributions/OpenOfficeorg/javavendors_unx.xml b/jvmfwk/distributions/OpenOfficeorg/javavendors_unx.xml index 5957f9c32..ffcf9682c 100755 --- a/jvmfwk/distributions/OpenOfficeorg/javavendors_unx.xml +++ b/jvmfwk/distributions/OpenOfficeorg/javavendors_unx.xml @@ -3,7 +3,7 @@ <javaSelection xmlns="http://openoffice.org/2004/java/framework/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <updated>2008-01-16</updated> + <updated>2004-01-30</updated> <vendorInfos> <vendor name="Sun Microsystems Inc."> @@ -14,4 +14,4 @@ <plugins> <library vendor="Sun Microsystems Inc.">vnd.sun.star.expand:$URE_INTERNAL_LIB_DIR/sunjavaplugin.so</library> </plugins> -</javaSelection>
\ No newline at end of file +</javaSelection> diff --git a/jvmfwk/distributions/OpenOfficeorg/javavendors_wnt.xml b/jvmfwk/distributions/OpenOfficeorg/javavendors_wnt.xml index 298d949de..267f02fb7 100644 --- a/jvmfwk/distributions/OpenOfficeorg/javavendors_wnt.xml +++ b/jvmfwk/distributions/OpenOfficeorg/javavendors_wnt.xml @@ -3,7 +3,7 @@ <javaSelection xmlns="http://openoffice.org/2004/java/framework/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <updated>2008-01-16</updated> + <updated>2004-01-30</updated> <vendorInfos> <vendor name="Sun Microsystems Inc."> diff --git a/jvmfwk/inc/jvmfwk/framework.h b/jvmfwk/inc/jvmfwk/framework.h index cdc97d801..abf1d9d2e 100644 --- a/jvmfwk/inc/jvmfwk/framework.h +++ b/jvmfwk/inc/jvmfwk/framework.h @@ -815,6 +815,27 @@ javaFrameworkError SAL_CALL jfw_setJRELocations( javaFrameworkError SAL_CALL jfw_getJRELocations( rtl_uString *** parLocations, sal_Int32 * pSize); + +/** 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_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> + */ +javaFrameworkError SAL_CALL jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist); + + /** locks this API so that it cannot be used by other threads. <p>If a different thread called this function before then the diff --git a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx index e6fe63658..28715412a 100755 --- a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx +++ b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx @@ -46,6 +46,7 @@ using namespace rtl; static sal_Bool hasOption(char const * szOption, int argc, char** argv); static rtl::OString getLD_LIBRARY_PATH(const rtl::ByteSequence & vendorData); +static bool findAndSelect(JavaInfo**); //static sal_Bool printPaths(const OUString& sPathFile); #define HELP_TEXT \ @@ -92,22 +93,29 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) fprintf(stderr,"javaldx failed! \n"); return -1; } - + if (pInfo == NULL) { - errcode = jfw_findAndSelectJRE( & pInfo); - if (errcode == JFW_E_NO_JAVA_FOUND) + if (false == findAndSelect(&pInfo)) + return -1; + } + else + { + //check if the JRE was not uninstalled + sal_Bool bExist = sal_False; + errcode = jfw_existJRE(pInfo, &bExist); + if (errcode == JFW_E_NONE) { - fprintf(stderr,"javaldx: Could not find a Java Runtime Environment! \n"); - return 0; + if (false == findAndSelect(&pInfo)) + return -1; } - else if (errcode != JFW_E_NONE && errcode != JFW_E_DIRECT_MODE) + else { - fprintf(stderr,"javaldx failed!\n"); + fprintf(stderr, "javaldx: Could not determine if JRE still exist\n"); return -1; } } - + //Only do something if the sunjavaplugin created this JavaInfo rtl::OUString sVendor1(RTL_CONSTASCII_USTRINGPARAM("Sun Microsystems Inc.")); rtl::OUString sVendor2(RTL_CONSTASCII_USTRINGPARAM("IBM Corporation")); @@ -162,7 +170,21 @@ static sal_Bool hasOption(char const * szOption, int argc, char** argv) return retVal; } - +static bool findAndSelect(JavaInfo ** ppInfo) +{ + javaFrameworkError errcode = jfw_findAndSelectJRE(ppInfo); + if (errcode == JFW_E_NO_JAVA_FOUND) + { + fprintf(stderr,"javaldx: Could not find a Java Runtime Environment! \n"); + return false; + } + else if (errcode != JFW_E_NONE && errcode != JFW_E_DIRECT_MODE) + { + fprintf(stderr,"javaldx failed!\n"); + return false; + } + return true; +} diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index 8019df550..d271a6683 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -34,6 +34,7 @@ #include "rtl/ustring.hxx" #include "rtl/bootstrap.hxx" #include "osl/thread.hxx" +#include "osl/file.hxx" #include "osl/module.hxx" #include "jvmfwk/framework.h" #include "jvmfwk/vendorplugin.h" @@ -1113,6 +1114,35 @@ javaFrameworkError SAL_CALL jfw_getJRELocations( return errcode; } + +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; + + ::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_E_ERROR; + } + + return ret; +} + void SAL_CALL jfw_lock() { jfw::FwkMutex::get().acquire(); diff --git a/jvmfwk/source/framework.map b/jvmfwk/source/framework.map index f8b887065..4f5b3381d 100644 --- a/jvmfwk/source/framework.map +++ b/jvmfwk/source/framework.map @@ -24,3 +24,8 @@ UDK_3_0_0 { local: *; }; + +UDK_3.1 { # OOo 3.1.0 + global: + jfw_existJRE; +} UDK_3_0_0; diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 206e91b42..a9e412590 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -881,11 +881,34 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) } case JFW_E_VM_CREATION_FAILED: { - //Error: - //%PRODUCTNAME requires a Java runtime environment (JRE) to perform - //this task. The selected JRE is defective. Please select another - //version or install a new JRE and select it under Tools - Options - - //%PRODUCTNAME - Java. + //If the creation failed because the JRE has been uninstalled then + //we search another one. As long as there is a javaldx, we should + //never come into this situation. javaldx checks alway if the JRE + //still exist. + JavaInfo * pJavaInfo = NULL; + if (JFW_E_NONE == jfw_getSelectedJRE(&pJavaInfo)) + { + sal_Bool bExist = sal_False; + if (JFW_E_NONE == jfw_existJRE(pJavaInfo, &bExist)) + { + if (bExist == sal_False + && ! (pJavaInfo->nRequirements & JFW_REQUIRE_NEEDRESTART)) + { + javaFrameworkError errFind = jfw_findAndSelectJRE( NULL ); + if (errFind == JFW_E_NONE) + { + continue; + } + } + } + } + + jfw_freeJavaInfo(pJavaInfo); + // + //Error: %PRODUCTNAME requires a Java + //runtime environment (JRE) to perform this task. The selected JRE + //is defective. Please select another version or install a new JRE + //and select it under Tools - Options - %PRODUCTNAME - Java. css::java::JavaVMCreationFailureException exc( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( |