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/09/28 18:35:00 UTC
[openoffice] branch path updated (70acd33a8f -> e99f7e8be4)
This is an automated email from the ASF dual-hosted git repository.
ardovm pushed a change to branch path
in repository https://gitbox.apache.org/repos/asf/openoffice.git
from 70acd33a8f Avoid empty paths
new 2e76830f97 Partial revert
new 52908b4630 Better logging
new e99f7e8be4 Better filtering
The 3 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 | 35 ++++++++++++---
main/jvmfwk/source/framework.cxx | 50 ++++++++++------------
main/jvmfwk/source/fwkbase.cxx | 4 +-
3 files changed, 55 insertions(+), 34 deletions(-)
[openoffice] 01/03: Partial revert
Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ardovm pushed a commit to branch path
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 2e76830f974e296557de18a79ea5b69967738b69
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Wed Sep 28 20:29:59 2022 +0200
Partial revert
---
main/jvmfwk/source/framework.cxx | 50 ++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 27 deletions(-)
diff --git a/main/jvmfwk/source/framework.cxx b/main/jvmfwk/source/framework.cxx
index bd6884d916..7fc5ae541c 100644
--- a/main/jvmfwk/source/framework.cxx
+++ b/main/jvmfwk/source/framework.cxx
@@ -266,7 +266,6 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti
std::vector<rtl::OString> vmParams;
rtl::OString sUserClassPath;
- rtl::OString sClassPathProp("-Djava.class.path=");
jfw::CJavaInfo aInfo;
jfw::JFW_MODE mode = jfw::getMode();
if (mode == jfw::JFW_MODE_APPLICATION)
@@ -338,7 +337,7 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti
//of the form UNO_JAVA_JFW_PARAMETER_1 .. UNO_JAVA_JFW_PARAMETER_n
vmParams = jfw::BootParams::getVMParameters();
sUserClassPath =
- sClassPathProp + jfw::BootParams::getClasspath();
+ "-Djava.class.path=" + jfw::BootParams::getClasspath();
}
else
OSL_ASSERT(0);
@@ -362,44 +361,41 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti
// create JavaVMOptions array that is passed to the plugin
// it contains the classpath and all options set in the
//options dialog
- std::vector<JavaVMOption> vecJOptions;
- vecJOptions.reserve(cOptions + 2 + vmParams.size());
-
- //The first argument is the classpath (if not empty)
- if (sUserClassPath != sClassPathProp) {
- vecJOptions.push_back(JavaVMOption());
- vecJOptions.back().optionString= (char*) sUserClassPath.getStr();
- vecJOptions.back().extraInfo = NULL;
- }
+ boost::scoped_array<JavaVMOption> sarJOptions(
+ new JavaVMOption[cOptions + 2 + vmParams.size()]);
+ JavaVMOption * arOpt = sarJOptions.get();
+ if (! arOpt)
+ return JFW_E_ERROR;
+
+ //The first argument is the classpath
+ arOpt[0].optionString= (char*) sUserClassPath.getStr();
+ arOpt[0].extraInfo = NULL;
// Set a flag that this JVM has been created via the JNI Invocation API
// (used, for example, by UNO remote bridges to share a common thread pool
// factory among Java and native bridge implementations):
- vecJOptions.push_back(JavaVMOption());
- vecJOptions.back().optionString = (char *) "-Dorg.openoffice.native=";
- vecJOptions.back().extraInfo = 0;
+ arOpt[1].optionString = (char *) "-Dorg.openoffice.native=";
+ arOpt[1].extraInfo = 0;
- //add the options set by options dialog, avoiding empty class paths
+ //add the options set by options dialog
+ int index = 2;
typedef std::vector<rtl::OString>::const_iterator cit;
for (cit i = vmParams.begin(); i != vmParams.end(); i ++)
{
- if (i->getStr() != sClassPathProp) {
- vecJOptions.push_back(JavaVMOption());
- vecJOptions.back().optionString = const_cast<sal_Char*>(i->getStr());
- vecJOptions.back().extraInfo = 0;
- }
+ arOpt[index].optionString = const_cast<sal_Char*>(i->getStr());
+ arOpt[index].extraInfo = 0;
+ index ++;
}
- //add all options of the arOptions argument, avoiding empty class paths
+ //add all options of the arOptions argument
for (int ii = 0; ii < cOptions; ii++)
{
- if (arOptions[ii].optionString != sClassPathProp) {
- vecJOptions.push_back(JavaVMOption());
- vecJOptions.back().optionString = arOptions[ii].optionString;
- vecJOptions.back().extraInfo = arOptions[ii].extraInfo;
- }
+ arOpt[index].optionString = arOptions[ii].optionString;
+ arOpt[index].extraInfo = arOptions[ii].extraInfo;
+ index++;
}
+
//start Java
JavaVM *pVm = NULL;
- javaPluginError plerr = (*pFunc)(aInfo, &vecJOptions[0], vecJOptions.size(), & pVm, ppEnv);
+ javaPluginError plerr = (*pFunc)(aInfo, arOpt, index, & pVm, ppEnv);
if (plerr == JFW_PLUGIN_E_VM_CREATION_FAILED)
{
errcode = JFW_E_VM_CREATION_FAILED;
[openoffice] 03/03: 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 path
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit e99f7e8be481f00305f0deab6b6995ef317cb336
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Wed Sep 28 20:32:04 2022 +0200
Better filtering
---
.../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 402094b357..d8442f7fba 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] 02/03: 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 path
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 52908b4630c7382895cbc3199d0e02e58d43def8
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Wed Sep 28 20:31:52 2022 +0200
Better logging
---
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;
}