summaryrefslogtreecommitdiffstats
path: root/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx')
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx109
1 files changed, 39 insertions, 70 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index b2cc8ed40803..395ef332e0e8 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -57,6 +57,7 @@
#include <jni.h>
#include <rtl/byteseq.hxx>
+#include <fwkbase.hxx>
#include <vendorplugin.hxx>
#include "util.hxx"
#include "sunversion.hxx"
@@ -296,19 +297,12 @@ javaPluginError checkJavaVersionRequirements(
javaPluginError jfw_plugin_getAllJavaInfos(
bool checkJavaHomeAndPath,
- OUString const& sVendor,
- OUString const& sMinVersion,
- OUString const& sMaxVersion,
- std::vector<OUString> const &arExcludeList,
+ jfw::VendorSettings const & vendorSettings,
std::vector<std::unique_ptr<JavaInfo>>* parJavaInfo,
std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos)
{
assert(parJavaInfo);
- OSL_ASSERT(!sVendor.isEmpty());
- if (sVendor.isEmpty())
- return javaPluginError::InvalidArg;
-
//Find all JREs
vector<rtl::Reference<VendorBase> > vecInfos =
addAllJREInfos(checkJavaHomeAndPath, infos);
@@ -316,17 +310,16 @@ javaPluginError jfw_plugin_getAllJavaInfos(
for (auto const& vecInfo : vecInfos)
{
+ if (auto const versionInfo = vendorSettings.getVersionInformation(vecInfo->getVendor()))
+ {
+ javaPluginError err = checkJavaVersionRequirements(
+ vecInfo, versionInfo->sMinVersion, versionInfo->sMaxVersion, versionInfo->vecExcludeVersions);
- if (sVendor != vecInfo->getVendor())
- continue;
-
- javaPluginError err = checkJavaVersionRequirements(
- vecInfo, sMinVersion, sMaxVersion, arExcludeList);
-
- if (err == javaPluginError::FailedVersion || err == javaPluginError::WrongArch)
- continue;
- else if (err == javaPluginError::WrongVersionFormat)
- return err;
+ if (err == javaPluginError::FailedVersion || err == javaPluginError::WrongArch)
+ continue;
+ else if (err == javaPluginError::WrongVersionFormat)
+ return err;
+ }
vecVerifiedInfos.push_back(vecInfo);
}
@@ -343,10 +336,7 @@ javaPluginError jfw_plugin_getAllJavaInfos(
javaPluginError jfw_plugin_getJavaInfoByPath(
OUString const& sPath,
- OUString const& sVendor,
- OUString const& sMinVersion,
- OUString const& sMaxVersion,
- std::vector<OUString> const &arExcludeList,
+ jfw::VendorSettings const & vendorSettings,
std::unique_ptr<JavaInfo> * ppInfo)
{
assert(ppInfo != nullptr);
@@ -354,19 +344,17 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
if (sPath.isEmpty())
return javaPluginError::InvalidArg;
- OSL_ASSERT(!sVendor.isEmpty());
- if (sVendor.isEmpty())
- return javaPluginError::InvalidArg;
-
rtl::Reference<VendorBase> aVendorInfo = getJREInfoByPath(sPath);
if (!aVendorInfo.is())
return javaPluginError::NoJre;
//Check if the detected JRE matches the version requirements
- if (sVendor != aVendorInfo->getVendor())
- return javaPluginError::NoJre;
- javaPluginError errorcode = checkJavaVersionRequirements(
- aVendorInfo, sMinVersion, sMaxVersion, arExcludeList);
+ javaPluginError errorcode = javaPluginError::NONE;
+ if (auto const versionInfo = vendorSettings.getVersionInformation(aVendorInfo->getVendor()))
+ {
+ errorcode = checkJavaVersionRequirements(
+ aVendorInfo, versionInfo->sMinVersion, versionInfo->sMaxVersion, versionInfo->vecExcludeVersions);
+ }
if (errorcode == javaPluginError::NONE)
*ppInfo = createJavaInfo(aVendorInfo);
@@ -375,7 +363,7 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
}
javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
- std::vector<pair<OUString, jfw::VersionInfo>> const& vecVendorInfos,
+ jfw::VendorSettings const & vendorSettings,
std::unique_ptr<JavaInfo> * ppInfo,
std::vector<rtl::Reference<VendorBase>> & infos)
{
@@ -389,32 +377,24 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
assert(infoJavaHome.size() == 1);
//Check if the detected JRE matches the version requirements
- for (auto const& vendorInfo : vecVendorInfos)
- {
- const OUString& vendor = vendorInfo.first;
- jfw::VersionInfo versionInfo = vendorInfo.second;
-
- if (vendor == infoJavaHome[0]->getVendor())
- {
- javaPluginError errorcode = checkJavaVersionRequirements(
+ auto const versionInfo = vendorSettings.getVersionInformation(infoJavaHome[0]->getVendor());
+ if (!versionInfo
+ || (checkJavaVersionRequirements(
infoJavaHome[0],
- versionInfo.sMinVersion,
- versionInfo.sMaxVersion,
- versionInfo.vecExcludeVersions);
-
- if (errorcode == javaPluginError::NONE)
- {
- *ppInfo = createJavaInfo(infoJavaHome[0]);
- return javaPluginError::NONE;
- }
- }
+ versionInfo->sMinVersion,
+ versionInfo->sMaxVersion,
+ versionInfo->vecExcludeVersions)
+ == javaPluginError::NONE))
+ {
+ *ppInfo = createJavaInfo(infoJavaHome[0]);
+ return javaPluginError::NONE;
}
return javaPluginError::NoJre;
}
javaPluginError jfw_plugin_getJavaInfosFromPath(
- std::vector<std::pair<OUString, jfw::VersionInfo>> const& vecVendorInfos,
+ jfw::VendorSettings const & vendorSettings,
std::vector<std::unique_ptr<JavaInfo>> & javaInfosFromPath,
std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos)
{
@@ -427,24 +407,16 @@ javaPluginError jfw_plugin_getJavaInfosFromPath(
// copy infos of JREs that meet version requirements to vecVerifiedInfos
for (auto const& infosFromPath : vecInfosFromPath)
{
- for (auto const& vendorInfo : vecVendorInfos)
- {
- const OUString& vendor = vendorInfo.first;
- jfw::VersionInfo const & versionInfo = vendorInfo.second;
-
- if (vendor == infosFromPath->getVendor())
- {
- javaPluginError errorcode = checkJavaVersionRequirements(
+ auto const versionInfo = vendorSettings.getVersionInformation(infosFromPath->getVendor());
+ if (!versionInfo
+ || (checkJavaVersionRequirements(
infosFromPath,
- versionInfo.sMinVersion,
- versionInfo.sMaxVersion,
- versionInfo.vecExcludeVersions);
-
- if (errorcode == javaPluginError::NONE)
- {
- vecVerifiedInfos.push_back(createJavaInfo(infosFromPath));
- }
- }
+ versionInfo->sMinVersion,
+ versionInfo->sMaxVersion,
+ versionInfo->vecExcludeVersions)
+ == javaPluginError::NONE))
+ {
+ vecVerifiedInfos.push_back(createJavaInfo(infosFromPath));
}
}
@@ -621,9 +593,6 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
// unless errorcode is volatile the following warning occurs on gcc:
// warning: variable 'errorcode' might be clobbered by `longjmp' or `vfork'
volatile javaPluginError errorcode = javaPluginError::NONE;
- //Check if the Vendor (pInfo->sVendor) is supported by this plugin
- if ( ! isVendorSupported(pInfo->sVendor))
- return javaPluginError::WrongVendor;
#ifdef MACOSX
rtl::Reference<VendorBase> aVendorInfo = getJREInfoByPath( pInfo->sLocation );
if ( !aVendorInfo.is() || aVendorInfo->compareVersions( pInfo->sVersion ) < 0 )