diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-03-09 20:43:09 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-03-13 08:16:32 +0000 |
commit | 9143dd4ebe37b608e43d04434cf831624bf55b65 (patch) | |
tree | 6b5129958363f1f36b3a8a394d6741ec8bb2b40c /jvmfwk/plugins | |
parent | 898f3541371a3fc59afb0907d3397a4876791789 (diff) |
Related tdf#54443 List only matching JREs
I.e. show only 64bit JRE for 64bit LO and 32bit JRE for 32bit LO
Change-Id: Id5e890637c7e1014bcb4e6fdd9ed9a33765112d5
Reviewed-on: https://gerrit.libreoffice.org/35026
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'jvmfwk/plugins')
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 6 | ||||
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx | 26 |
2 files changed, 30 insertions, 2 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index 63791bceac16..d69b439f2f0a 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -227,6 +227,10 @@ javaPluginError checkJavaVersionRequirements( rtl_uString * * arExcludeList, sal_Int32 nLenList) { + if (!aVendorInfo->isValidArch()) + { + return javaPluginError::WrongArch; + } if (!sMinVersion.isEmpty()) { try @@ -334,7 +338,7 @@ javaPluginError jfw_plugin_getAllJavaInfos( javaPluginError err = checkJavaVersionRequirements( cur, sMinVersion, sMaxVersion, arExcludeList, nLenList); - if (err == javaPluginError::FailedVersion) + if (err == javaPluginError::FailedVersion || err == javaPluginError::WrongArch) continue; else if (err == javaPluginError::WrongVersionFormat) return err; diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx index 9b580ccaa8fb..ef9da176ebc4 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx @@ -62,12 +62,14 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) OUString sVendorProperty("java.vendor"); OUString sVersionProperty("java.version"); OUString sHomeProperty("java.home"); + OUString sArchProperty("os.arch"); OUString sAccessProperty("javax.accessibility.assistive_technologies"); bool bVersion = false; bool bVendor = false; bool bHome = false; bool bAccess = false; + bool bArch = false; typedef vector<pair<OUString, OUString> >::const_iterator it_prop; for (it_prop i = props.begin(); i != props.end(); ++i) @@ -103,6 +105,11 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) bHome = true; #endif } + else if (!bArch && sArchProperty.equals(i->first)) + { + m_sArch = i->second; + bArch = true; + } else if (!bAccess && sAccessProperty.equals(i->first)) { if (!i->second.isEmpty()) @@ -115,7 +122,7 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) //must search through all properties. } - if (!bVersion || !bVendor || !bHome) + if (!bVersion || !bVendor || !bHome || !bArch) return false; // init m_sRuntimeLibrary @@ -201,6 +208,23 @@ const OUString & VendorBase::getRuntimeLibrary() const { return m_sRuntimeLibrary; } + +bool VendorBase::isValidArch() const +{ + // Warning: These values come from the "os.arch" property. + // It is not defined what the exact values are. + // Oracle JRE 8 has "x86" and "amd64", the others were found at http://lopica.sourceforge.net/os.html . + // There might still be missing some options; we need to extend the check once we find out. +#if defined _WIN32 + return m_sArch == "x86" || m_sArch == "i386" || m_sArch == "i686"; +#elif defined _WIN64 + return m_sArch == "amd64" || m_sArch == "x86_64"; +#else + (void)this; + return true; +#endif +} + bool VendorBase::supportsAccessibility() const { return m_bAccessibility; |