You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2022/12/03 10:49:11 UTC

[openoffice] branch AOO41X updated (4adc4068df -> 6dbc57fb81)

This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a change to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


    from 4adc4068df Revert last commit
     new 626e624c12 Avoid empty paths
     new 2261370f20 Better logging
     new 54c60f80f9 Better filtering
     new 0b9007ea3f Fix compilation under MSW
     new 1e5ed18f1e Set the default JVM classpath to $OOO_BASE_DIR/program
     new 6dbc57fb81 Add separator to an already existing path only

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../plugins/sunmajor/pluginlib/sunjavaplugin.cxx   | 97 ++++++++++++++++------
 main/jvmfwk/source/fwkbase.cxx                     |  9 +-
 main/xmerge/source/activesync/XMergeFilter.cpp     |  7 +-
 3 files changed, 83 insertions(+), 30 deletions(-)


[openoffice] 02/06: Better logging

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 2261370f206518b2d67d8da8fa08f72431a85167
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Wed Sep 28 20:31:52 2022 +0200

    Better logging
    
    (cherry picked from commit 84ee7f0fce15afc7bf37aac517e0ddd08cacf717)
---
 main/jvmfwk/source/fwkbase.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/main/jvmfwk/source/fwkbase.cxx b/main/jvmfwk/source/fwkbase.cxx
index 6af713f60e..293153ce96 100644
--- a/main/jvmfwk/source/fwkbase.cxx
+++ b/main/jvmfwk/source/fwkbase.cxx
@@ -386,7 +386,7 @@ rtl::OString BootParams::getClasspath()
             sCP, osl_getThreadTextEncoding());
 #if OSL_DEBUG_LEVEL >=2
         fprintf(stderr,"[Java framework] Using bootstrap parameter "
-            UNO_JAVA_JFW_CLASSPATH " = %s.\n", sClassPath.getStr());
+            UNO_JAVA_JFW_CLASSPATH " = \"%s\".\n", sClassPath.getStr());
 #endif
     }
     
@@ -521,7 +521,7 @@ rtl::OUString BootParams::getClasspathUrls()
 #if OSL_DEBUG_LEVEL >=2
     rtl::OString sValue = rtl::OUStringToOString(sParams, osl_getThreadTextEncoding());
     fprintf(stderr,"[Java framework] Using bootstrap parameter "
-            UNO_JAVA_JFW_CLASSPATH_URLS " = %s.\n", sValue.getStr());
+            UNO_JAVA_JFW_CLASSPATH_URLS " = \"%s\".\n", sValue.getStr());
 #endif
     return sParams;
 }


[openoffice] 01/06: Avoid empty paths

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 626e624c128f1faec44d18081e6f415e4f6877c8
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Wed Jul 20 21:02:27 2022 +0200

    Avoid empty paths
    
    (cherry picked from commit 55c2ab0d6a9ca16126fedfd274a3c3de19701d91)
---
 .../plugins/sunmajor/pluginlib/sunjavaplugin.cxx   | 42 +++++++++++++---------
 main/xmerge/source/activesync/XMergeFilter.cpp     |  7 ++--
 2 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 00b636f47f..72774169d8 100644
--- a/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -508,16 +508,16 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
     // be encoded with the system encoding (i.e., osl_getThreadTextEncoding):
     JavaVMInitArgs vm_args;
 
-    boost::scoped_array<JavaVMOption> sarOptions(
-        new JavaVMOption[cOptions + 1]);
-    JavaVMOption * options = sarOptions.get();
+    std::vector<JavaVMOption> vecOptions;
+    vecOptions.reserve(cOptions + 1);
     
     // We set an abort handler which is called when the VM calls _exit during
     // JNI_CreateJavaVM. This happens when the LD_LIBRARY_PATH does not contain
     // all some directories of the Java installation. This is necessary for
     // all versions below 1.5.1
-    options[0].optionString= (char *) "abort";
-    options[0].extraInfo= (void* )(sal_IntPtr)abort_handler;
+    vecOptions.push_back(JavaVMOption());
+    vecOptions.back().optionString = (char *) "abort";
+    vecOptions.back().extraInfo = (void* )(sal_IntPtr)abort_handler;
     rtl::OString sClassPathProp("-Djava.class.path=");
     rtl::OString sClassPathOption;
     for (int i = 0; i < cOptions; i++)
@@ -528,25 +528,35 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
         rtl::OString sClassPath = arOptions[i].optionString;
         if (sClassPath.match(sClassPathProp, 0) == sal_True)
         {
+            bool emptyClassPath = (sClassPath == sClassPathProp);
             char sep[] =  {SAL_PATHSEPARATOR, 0};
             OString sAddPath = getPluginJarPath(pInfo->sVendor, pInfo->sLocation,pInfo->sVersion);
-            if (sAddPath.getLength())
-                sClassPathOption = sClassPath + rtl::OString(sep) + sAddPath;
-            else
+            if (sAddPath.getLength()) {
                 sClassPathOption = sClassPath;
-            options[i+1].optionString = (char *) sClassPathOption.getStr();
-            options[i+1].extraInfo = arOptions[i].extraInfo;
+                if (!emptyClassPath) {
+                    sClassPathOption += rtl::OString(sep);
+                }
+                sClassPathOption += sAddPath;
+                emptyClassPath = false;
+            } else
+                sClassPathOption = sClassPath;
+            if (!emptyClassPath) {
+                vecOptions.push_back(JavaVMOption());
+                vecOptions.back().optionString = (char *) sClassPathOption.getStr();
+                vecOptions.back().extraInfo = arOptions[i].extraInfo;
+            } // else avoid empty class path
         }
         else
         {
-#endif        
-            options[i+1].optionString = arOptions[i].optionString;
-            options[i+1].extraInfo = arOptions[i].extraInfo;
+#endif
+            vecOptions.push_back(JavaVMOption());
+            vecOptions.back().optionString = arOptions[i].optionString;
+            vecOptions.back().extraInfo = arOptions[i].extraInfo;
 #ifdef UNX
         }
 #endif
 #if OSL_DEBUG_LEVEL >= 2
-        JFW_TRACE2(OString("VM option: ") + OString(options[i+1].optionString) +
+        JFW_TRACE2(OString("VM option: ") + OString(vecOptions.back().optionString) +
                    OString("\n"));
 #endif
     }
@@ -556,8 +566,8 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
 #else
     vm_args.version= JNI_VERSION_1_2;
 #endif
-    vm_args.options= options;
-    vm_args.nOptions= cOptions + 1;
+    vm_args.options= &vecOptions[0];
+    vm_args.nOptions= vecOptions.size();
     vm_args.ignoreUnrecognized= JNI_TRUE;
 
     /* We set a global flag which is used by the abort handler in order to
diff --git a/main/xmerge/source/activesync/XMergeFilter.cpp b/main/xmerge/source/activesync/XMergeFilter.cpp
index 47a4ec1d35..6be191e244 100644
--- a/main/xmerge/source/activesync/XMergeFilter.cpp
+++ b/main/xmerge/source/activesync/XMergeFilter.cpp
@@ -290,8 +290,11 @@ STDMETHODIMP CXMergeFilter::NextConvertFile(int nConversion, CFF_CONVERTINFO *pc
 
 	
 	// Need to build the entire command line for calling out to Java	
-	appArgs =  appName + " -Djava.class.path=";
-	appArgs += m_szClasspath;
+	appArgs = appName;
+        if (*m_szClasspath) {
+            appArgs += " -Djava.class.path=";
+            appArgs += m_szClasspath;
+        } // else avoid empty class path
 	appArgs += " org.openoffice.xmerge.util.ActiveSyncDriver ";
 
 	if (!lstrcmp(psf->szExtension, "sxw"))


[openoffice] 05/06: Set the default JVM classpath to $OOO_BASE_DIR/program

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 1e5ed18f1ede65ba39f728f72cbfaabb1fc6e252
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Mon Oct 31 09:31:19 2022 +0100

    Set the default JVM classpath to $OOO_BASE_DIR/program
    
    (cherry picked from commit 69af28e78361a11b97a2d51674346f34921f0236)
---
 .../plugins/sunmajor/pluginlib/sunjavaplugin.cxx   | 32 +++++++++++++++-------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index dcecf2e1e9..b3da0c4ff3 100644
--- a/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -527,23 +527,38 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
     for (int i = 0; i < cOptions; i++)
     {
         rtl::OString sOptionString = arOptions[i].optionString;
-#ifdef UNX
-    // Until java 1.5 we need to put a plugin.jar or javaplugin.jar (<1.4.2)
-    // in the class path in order to have applet support.
         if (sOptionString.match(sClassPathProp, 0) == sal_True)
         {
+            // This option sets the class path
             bool emptyClassPath = (sOptionString == sClassPathProp);
             char sep[] =  {SAL_PATHSEPARATOR, 0};
-            OString sAddPath = getPluginJarPath(pInfo->sVendor, pInfo->sLocation,pInfo->sVersion);
+            OString sAddPath;
+            sClassPathOption = sOptionString;
+            // Add the installation directory as default class path
+            OUString macro(RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program"));
+            rtl::Bootstrap::expandMacros(macro);
+            OUString instDirectory;
+            osl_getSystemPathFromFileURL(macro.pData, &instDirectory.pData);
+            sAddPath = rtl::OUStringToOString(instDirectory, RTL_TEXTENCODING_UTF8);
+            if (sAddPath.getLength()) {
+                if (!emptyClassPath) {
+                    sClassPathOption += rtl::OString(sep);
+                }
+                sClassPathOption += sAddPath;
+                emptyClassPath = false;
+            }
+#ifdef UNX
+            // Until java 1.5 we need to put a plugin.jar or javaplugin.jar (<1.4.2)
+            // in the class path in order to have applet support.
+            sAddPath = getPluginJarPath(pInfo->sVendor, pInfo->sLocation,pInfo->sVersion);
             if (sAddPath.getLength()) {
-                sClassPathOption = sOptionString;
                 if (!emptyClassPath) {
                     sClassPathOption += rtl::OString(sep);
                 }
                 sClassPathOption += sAddPath;
                 emptyClassPath = false;
-            } else
-                sClassPathOption = sOptionString;
+            }
+#endif
             if (!emptyClassPath) {
                 vecOptions.push_back(JavaVMOption());
                 vecOptions.back().optionString = (char *) sClassPathOption.getStr();
@@ -552,13 +567,10 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
         }
         else
         {
-#endif
             vecOptions.push_back(JavaVMOption());
             vecOptions.back().optionString = arOptions[i].optionString;
             vecOptions.back().extraInfo = arOptions[i].extraInfo;
-#ifdef UNX
         }
-#endif
         sOptionString = vecOptions.back().optionString;
         if (sOptionString.match(sClassPathProp, 0) == sal_True) {
             // Check for empty entries in the class path


[openoffice] 03/06: Better filtering

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 54c60f80f9f78d4fe91c705f42de9ca3ce978ec9
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Wed Sep 28 20:32:04 2022 +0200

    Better filtering
    
    (cherry picked from commit 597faa034e88ed743c2c324e8e98b5583ae83a4d)
---
 .../plugins/sunmajor/pluginlib/sunjavaplugin.cxx   | 35 ++++++++++++++++++----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 72774169d8..e40e3bdf41 100644
--- a/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -518,6 +518,10 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
     vecOptions.push_back(JavaVMOption());
     vecOptions.back().optionString = (char *) "abort";
     vecOptions.back().extraInfo = (void* )(sal_IntPtr)abort_handler;
+#if OSL_DEBUG_LEVEL >= 2
+        JFW_TRACE2(OString("VM option: ") + OString(vecOptions.back().optionString) +
+                   OString("\n"));
+#endif
     rtl::OString sClassPathProp("-Djava.class.path=");
     rtl::OString sClassPathOption;
     for (int i = 0; i < cOptions; i++)
@@ -525,21 +529,21 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
 #ifdef UNX
     // Until java 1.5 we need to put a plugin.jar or javaplugin.jar (<1.4.2)
     // in the class path in order to have applet support.
-        rtl::OString sClassPath = arOptions[i].optionString;
-        if (sClassPath.match(sClassPathProp, 0) == sal_True)
+        rtl::OString sOptionString = arOptions[i].optionString;
+        if (sOptionString.match(sClassPathProp, 0) == sal_True)
         {
-            bool emptyClassPath = (sClassPath == sClassPathProp);
+            bool emptyClassPath = (sOptionString == sClassPathProp);
             char sep[] =  {SAL_PATHSEPARATOR, 0};
             OString sAddPath = getPluginJarPath(pInfo->sVendor, pInfo->sLocation,pInfo->sVersion);
             if (sAddPath.getLength()) {
-                sClassPathOption = sClassPath;
+                sClassPathOption = sOptionString;
                 if (!emptyClassPath) {
                     sClassPathOption += rtl::OString(sep);
                 }
                 sClassPathOption += sAddPath;
                 emptyClassPath = false;
             } else
-                sClassPathOption = sClassPath;
+                sClassPathOption = sOptionString;
             if (!emptyClassPath) {
                 vecOptions.push_back(JavaVMOption());
                 vecOptions.back().optionString = (char *) sClassPathOption.getStr();
@@ -555,6 +559,27 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
 #ifdef UNX
         }
 #endif
+        sOptionString = vecOptions.back().optionString;
+        if (sOptionString.match(sClassPathProp, 0) == sal_True) {
+            // Check for empty entries in the class path
+            sal_Int32 nIndex = sClassPathProp.getLength();
+            rtl::OString sToken;
+            char empty1[] = {'.', 0};
+            char empty2[] = {'.', SAL_PATHDELIMITER, 0};
+            const rtl::OString sEmpty1 = rtl::OString(empty1);
+            const rtl::OString sEmpty2 = rtl::OString(empty2);
+            do {
+                sToken = sOptionString.getToken(0, SAL_PATHSEPARATOR, nIndex);
+                if ((sToken.getLength() == 0) ||
+                    (sToken == sEmpty1) ||
+                    (sToken == sEmpty2)) {
+                    fprintf(stderr,"[Java framework]sunjavaplugin"
+                            SAL_DLLEXTENSION
+                            " Rejecting empty class path entry !\n");
+                    return JFW_PLUGIN_E_INVALID_ARG;
+                }
+            } while (nIndex >= 0);
+        }
 #if OSL_DEBUG_LEVEL >= 2
         JFW_TRACE2(OString("VM option: ") + OString(vecOptions.back().optionString) +
                    OString("\n"));


[openoffice] 04/06: Fix compilation under MSW

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 0b9007ea3f1524177343ea8df9d3fca1792efe69
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Fri Sep 30 09:16:19 2022 +0200

    Fix compilation under MSW
    
    (cherry picked from commit d103c092b2f69d7eeed1cfccf923d1a76a4ade17)
---
 main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index e40e3bdf41..dcecf2e1e9 100644
--- a/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -526,10 +526,10 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
     rtl::OString sClassPathOption;
     for (int i = 0; i < cOptions; i++)
     {
+        rtl::OString sOptionString = arOptions[i].optionString;
 #ifdef UNX
     // Until java 1.5 we need to put a plugin.jar or javaplugin.jar (<1.4.2)
     // in the class path in order to have applet support.
-        rtl::OString sOptionString = arOptions[i].optionString;
         if (sOptionString.match(sClassPathProp, 0) == sal_True)
         {
             bool emptyClassPath = (sOptionString == sClassPathProp);


[openoffice] 06/06: Add separator to an already existing path only

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 6dbc57fb81ba1ad9542597db575e92ff511d845f
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Sat Nov 12 08:02:06 2022 +0100

    Add separator to an already existing path only
    
    (cherry picked from commit a543930b28f88aae91acc3be9d2fcf0e281a4ae0)
---
 main/jvmfwk/source/fwkbase.cxx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/main/jvmfwk/source/fwkbase.cxx b/main/jvmfwk/source/fwkbase.cxx
index 293153ce96..f5cab3fa7a 100644
--- a/main/jvmfwk/source/fwkbase.cxx
+++ b/main/jvmfwk/source/fwkbase.cxx
@@ -398,7 +398,10 @@ rtl::OString BootParams::getClasspath()
         char * pCp = getenv("CLASSPATH");
         if (pCp)
         {
-            sClassPath += rtl::OString(szSep) + rtl::OString(pCp);
+            if (sClassPath.getLength()) {
+                sClassPath += rtl::OString(szSep);
+            }
+            sClassPath += rtl::OString(pCp);
         }
 #if OSL_DEBUG_LEVEL >=2
         fprintf(stderr,"[Java framework] Using bootstrap parameter "