Kaydet (Commit) 9143dd4e authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

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/35026Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst 898f3541
...@@ -133,6 +133,7 @@ public: ...@@ -133,6 +133,7 @@ public:
const OUString & getRuntimeLibrary() const; const OUString & getRuntimeLibrary() const;
const OUString & getLibraryPath() const; const OUString & getLibraryPath() const;
bool supportsAccessibility() const; bool supportsAccessibility() const;
bool isValidArch() const;
/* determines if prior to running java something has to be done, /* determines if prior to running java something has to be done,
like setting the LD_LIBRARY_PATH. This implementation checks like setting the LD_LIBRARY_PATH. This implementation checks
if an LD_LIBRARY_PATH (getLD_LIBRARY_PATH) needs to be set and if an LD_LIBRARY_PATH (getLD_LIBRARY_PATH) needs to be set and
...@@ -178,6 +179,7 @@ protected: ...@@ -178,6 +179,7 @@ protected:
OUString m_sHome; OUString m_sHome;
OUString m_sRuntimeLibrary; OUString m_sRuntimeLibrary;
OUString m_sLD_LIBRARY_PATH; OUString m_sLD_LIBRARY_PATH;
OUString m_sArch;
bool m_bAccessibility; bool m_bAccessibility;
......
...@@ -55,6 +55,7 @@ enum class javaPluginError ...@@ -55,6 +55,7 @@ enum class javaPluginError
FailedVersion, FailedVersion,
NoJre, NoJre,
WrongVendor, WrongVendor,
WrongArch,
VmCreationFailed VmCreationFailed
}; };
......
...@@ -227,6 +227,10 @@ javaPluginError checkJavaVersionRequirements( ...@@ -227,6 +227,10 @@ javaPluginError checkJavaVersionRequirements(
rtl_uString * * arExcludeList, rtl_uString * * arExcludeList,
sal_Int32 nLenList) sal_Int32 nLenList)
{ {
if (!aVendorInfo->isValidArch())
{
return javaPluginError::WrongArch;
}
if (!sMinVersion.isEmpty()) if (!sMinVersion.isEmpty())
{ {
try try
...@@ -334,7 +338,7 @@ javaPluginError jfw_plugin_getAllJavaInfos( ...@@ -334,7 +338,7 @@ javaPluginError jfw_plugin_getAllJavaInfos(
javaPluginError err = checkJavaVersionRequirements( javaPluginError err = checkJavaVersionRequirements(
cur, sMinVersion, sMaxVersion, arExcludeList, nLenList); cur, sMinVersion, sMaxVersion, arExcludeList, nLenList);
if (err == javaPluginError::FailedVersion) if (err == javaPluginError::FailedVersion || err == javaPluginError::WrongArch)
continue; continue;
else if (err == javaPluginError::WrongVersionFormat) else if (err == javaPluginError::WrongVersionFormat)
return err; return err;
......
...@@ -62,12 +62,14 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) ...@@ -62,12 +62,14 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
OUString sVendorProperty("java.vendor"); OUString sVendorProperty("java.vendor");
OUString sVersionProperty("java.version"); OUString sVersionProperty("java.version");
OUString sHomeProperty("java.home"); OUString sHomeProperty("java.home");
OUString sArchProperty("os.arch");
OUString sAccessProperty("javax.accessibility.assistive_technologies"); OUString sAccessProperty("javax.accessibility.assistive_technologies");
bool bVersion = false; bool bVersion = false;
bool bVendor = false; bool bVendor = false;
bool bHome = false; bool bHome = false;
bool bAccess = false; bool bAccess = false;
bool bArch = false;
typedef vector<pair<OUString, OUString> >::const_iterator it_prop; typedef vector<pair<OUString, OUString> >::const_iterator it_prop;
for (it_prop i = props.begin(); i != props.end(); ++i) for (it_prop i = props.begin(); i != props.end(); ++i)
...@@ -103,6 +105,11 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) ...@@ -103,6 +105,11 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
bHome = true; bHome = true;
#endif #endif
} }
else if (!bArch && sArchProperty.equals(i->first))
{
m_sArch = i->second;
bArch = true;
}
else if (!bAccess && sAccessProperty.equals(i->first)) else if (!bAccess && sAccessProperty.equals(i->first))
{ {
if (!i->second.isEmpty()) if (!i->second.isEmpty())
...@@ -115,7 +122,7 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props) ...@@ -115,7 +122,7 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
//must search through all properties. //must search through all properties.
} }
if (!bVersion || !bVendor || !bHome) if (!bVersion || !bVendor || !bHome || !bArch)
return false; return false;
// init m_sRuntimeLibrary // init m_sRuntimeLibrary
...@@ -201,6 +208,23 @@ const OUString & VendorBase::getRuntimeLibrary() const ...@@ -201,6 +208,23 @@ const OUString & VendorBase::getRuntimeLibrary() const
{ {
return m_sRuntimeLibrary; 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 bool VendorBase::supportsAccessibility() const
{ {
return m_bAccessibility; return m_bAccessibility;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment