summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jvmfwk/inc/vendorbase.hxx2
-rw-r--r--jvmfwk/inc/vendorplugin.hxx1
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx6
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx26
4 files changed, 33 insertions, 2 deletions
diff --git a/jvmfwk/inc/vendorbase.hxx b/jvmfwk/inc/vendorbase.hxx
index 2a24c9590858..c9ebcb256913 100644
--- a/jvmfwk/inc/vendorbase.hxx
+++ b/jvmfwk/inc/vendorbase.hxx
@@ -133,6 +133,7 @@ public:
const OUString & getRuntimeLibrary() const;
const OUString & getLibraryPath() const;
bool supportsAccessibility() const;
+ bool isValidArch() const;
/* determines if prior to running java something has to be done,
like setting the LD_LIBRARY_PATH. This implementation checks
if an LD_LIBRARY_PATH (getLD_LIBRARY_PATH) needs to be set and
@@ -178,6 +179,7 @@ protected:
OUString m_sHome;
OUString m_sRuntimeLibrary;
OUString m_sLD_LIBRARY_PATH;
+ OUString m_sArch;
bool m_bAccessibility;
diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx
index c9a2ccbbf01e..8d019f1c4474 100644
--- a/jvmfwk/inc/vendorplugin.hxx
+++ b/jvmfwk/inc/vendorplugin.hxx
@@ -55,6 +55,7 @@ enum class javaPluginError
FailedVersion,
NoJre,
WrongVendor,
+ WrongArch,
VmCreationFailed
};
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;