Check each potential JRE location only once
i.e., after recent "fdo#83753: consider JAVA_HOME and PATH when selecting JRE" fix, if jfw_findAndSelectJRE found no suitable JRE in jfw_plugin_getJavaInfoFromJavaHome or jfw_plugin_getJavaInfosFromPath, do not re-check those locations in jfw_plugin_getAllJavaInfos. Change-Id: If4e085b4fceff5b2494c7b7b84ac51691dbc78cc
This commit is contained in:
@@ -22,11 +22,13 @@
|
|||||||
#define INCLUDED_JVMFWK_INC_VENDORPLUGIN_HXX
|
#define INCLUDED_JVMFWK_INC_VENDORPLUGIN_HXX
|
||||||
|
|
||||||
#include <jvmfwk/framework.h>
|
#include <jvmfwk/framework.h>
|
||||||
|
#include <rtl/ref.hxx>
|
||||||
#include <rtl/ustring.h>
|
#include <rtl/ustring.h>
|
||||||
#include "jni.h"
|
#include "jni.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "../source/elements.hxx"
|
#include "../source/elements.hxx"
|
||||||
|
#include <vendorbase.hxx>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@file
|
@file
|
||||||
@@ -112,13 +114,15 @@ typedef enum
|
|||||||
version strings.
|
version strings.
|
||||||
*/
|
*/
|
||||||
javaPluginError jfw_plugin_getAllJavaInfos(
|
javaPluginError jfw_plugin_getAllJavaInfos(
|
||||||
|
bool checkJavaHomeAndPath,
|
||||||
OUString const& sVendor,
|
OUString const& sVendor,
|
||||||
OUString const& sMinVersion,
|
OUString const& sMinVersion,
|
||||||
OUString const& sMaxVersion,
|
OUString const& sMaxVersion,
|
||||||
rtl_uString * * arExcludeList,
|
rtl_uString * * arExcludeList,
|
||||||
sal_Int32 nSizeExcludeList,
|
sal_Int32 nSizeExcludeList,
|
||||||
JavaInfo*** parJavaInfo,
|
JavaInfo*** parJavaInfo,
|
||||||
sal_Int32 *nSizeJavaInfo);
|
sal_Int32 *nSizeJavaInfo,
|
||||||
|
std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos);
|
||||||
|
|
||||||
/** obtains information for a JRE at a given location.
|
/** obtains information for a JRE at a given location.
|
||||||
|
|
||||||
@@ -202,7 +206,8 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
|
|||||||
*/
|
*/
|
||||||
javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
|
javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
|
||||||
std::vector<std::pair<OUString, jfw::VersionInfo>> const& vecVendorInfos,
|
std::vector<std::pair<OUString, jfw::VersionInfo>> const& vecVendorInfos,
|
||||||
JavaInfo ** ppInfo);
|
JavaInfo ** ppInfo,
|
||||||
|
std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos);
|
||||||
|
|
||||||
|
|
||||||
/** obtains information about installations of Java Runtime Environments (JREs)
|
/** obtains information about installations of Java Runtime Environments (JREs)
|
||||||
@@ -244,7 +249,8 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
|
|||||||
|
|
||||||
javaPluginError jfw_plugin_getJavaInfosFromPath(
|
javaPluginError jfw_plugin_getJavaInfosFromPath(
|
||||||
std::vector<std::pair<OUString, jfw::VersionInfo>> const& vecVendorInfos,
|
std::vector<std::pair<OUString, jfw::VersionInfo>> const& vecVendorInfos,
|
||||||
std::vector<JavaInfo*> & vecJavaInfosFromPath);
|
std::vector<JavaInfo*> & vecJavaInfosFromPath,
|
||||||
|
std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos);
|
||||||
|
|
||||||
/** starts a Java Virtual Machine.
|
/** starts a Java Virtual Machine.
|
||||||
|
|
||||||
|
@@ -299,13 +299,15 @@ javaPluginError checkJavaVersionRequirements(
|
|||||||
}
|
}
|
||||||
|
|
||||||
javaPluginError jfw_plugin_getAllJavaInfos(
|
javaPluginError jfw_plugin_getAllJavaInfos(
|
||||||
|
bool checkJavaHomeAndPath,
|
||||||
OUString const& sVendor,
|
OUString const& sVendor,
|
||||||
OUString const& sMinVersion,
|
OUString const& sMinVersion,
|
||||||
OUString const& sMaxVersion,
|
OUString const& sMaxVersion,
|
||||||
rtl_uString * *arExcludeList,
|
rtl_uString * *arExcludeList,
|
||||||
sal_Int32 nLenList,
|
sal_Int32 nLenList,
|
||||||
JavaInfo*** parJavaInfo,
|
JavaInfo*** parJavaInfo,
|
||||||
sal_Int32 *nLenInfoList)
|
sal_Int32 *nLenInfoList,
|
||||||
|
std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos)
|
||||||
{
|
{
|
||||||
OSL_ASSERT(parJavaInfo);
|
OSL_ASSERT(parJavaInfo);
|
||||||
OSL_ASSERT(nLenInfoList);
|
OSL_ASSERT(nLenInfoList);
|
||||||
@@ -326,7 +328,7 @@ javaPluginError jfw_plugin_getAllJavaInfos(
|
|||||||
|
|
||||||
//Find all JREs
|
//Find all JREs
|
||||||
vector<rtl::Reference<VendorBase> > vecInfos =
|
vector<rtl::Reference<VendorBase> > vecInfos =
|
||||||
getAllJREInfos();
|
addAllJREInfos(checkJavaHomeAndPath, infos);
|
||||||
vector<rtl::Reference<VendorBase> > vecVerifiedInfos;
|
vector<rtl::Reference<VendorBase> > vecVerifiedInfos;
|
||||||
|
|
||||||
typedef vector<rtl::Reference<VendorBase> >::iterator it;
|
typedef vector<rtl::Reference<VendorBase> >::iterator it;
|
||||||
@@ -406,15 +408,17 @@ javaPluginError jfw_plugin_getJavaInfoByPath(
|
|||||||
|
|
||||||
javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
|
javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
|
||||||
std::vector<pair<OUString, jfw::VersionInfo>> const& vecVendorInfos,
|
std::vector<pair<OUString, jfw::VersionInfo>> const& vecVendorInfos,
|
||||||
JavaInfo ** ppInfo)
|
JavaInfo ** ppInfo, std::vector<rtl::Reference<VendorBase>> & infos)
|
||||||
{
|
{
|
||||||
if (!ppInfo)
|
if (!ppInfo)
|
||||||
return JFW_PLUGIN_E_INVALID_ARG;
|
return JFW_PLUGIN_E_INVALID_ARG;
|
||||||
|
|
||||||
rtl::Reference<VendorBase> infoJavaHome = getJavaInfoFromJavaHome();
|
std::vector<rtl::Reference<VendorBase>> infoJavaHome;
|
||||||
|
addJavaInfoFromJavaHome(infos, infoJavaHome);
|
||||||
|
|
||||||
if (!infoJavaHome.is())
|
if (infoJavaHome.empty())
|
||||||
return JFW_PLUGIN_E_NO_JRE;
|
return JFW_PLUGIN_E_NO_JRE;
|
||||||
|
assert(infoJavaHome.size() == 1);
|
||||||
|
|
||||||
//Check if the detected JRE matches the version requirements
|
//Check if the detected JRE matches the version requirements
|
||||||
typedef std::vector<pair<OUString, jfw::VersionInfo>>::const_iterator ci_pl;
|
typedef std::vector<pair<OUString, jfw::VersionInfo>>::const_iterator ci_pl;
|
||||||
@@ -423,10 +427,10 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
|
|||||||
const OUString& vendor = vendorInfo->first;
|
const OUString& vendor = vendorInfo->first;
|
||||||
jfw::VersionInfo versionInfo = vendorInfo->second;
|
jfw::VersionInfo versionInfo = vendorInfo->second;
|
||||||
|
|
||||||
if (vendor.equals(infoJavaHome->getVendor()))
|
if (vendor.equals(infoJavaHome[0]->getVendor()))
|
||||||
{
|
{
|
||||||
javaPluginError errorcode = checkJavaVersionRequirements(
|
javaPluginError errorcode = checkJavaVersionRequirements(
|
||||||
infoJavaHome,
|
infoJavaHome[0],
|
||||||
versionInfo.sMinVersion,
|
versionInfo.sMinVersion,
|
||||||
versionInfo.sMaxVersion,
|
versionInfo.sMaxVersion,
|
||||||
versionInfo.getExcludeVersions(),
|
versionInfo.getExcludeVersions(),
|
||||||
@@ -434,7 +438,7 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
|
|||||||
|
|
||||||
if (errorcode == JFW_PLUGIN_E_NONE)
|
if (errorcode == JFW_PLUGIN_E_NONE)
|
||||||
{
|
{
|
||||||
*ppInfo = createJavaInfo(infoJavaHome);
|
*ppInfo = createJavaInfo(infoJavaHome[0]);
|
||||||
return JFW_PLUGIN_E_NONE;
|
return JFW_PLUGIN_E_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -445,11 +449,12 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
|
|||||||
|
|
||||||
javaPluginError jfw_plugin_getJavaInfosFromPath(
|
javaPluginError jfw_plugin_getJavaInfosFromPath(
|
||||||
std::vector<std::pair<OUString, jfw::VersionInfo>> const& vecVendorInfos,
|
std::vector<std::pair<OUString, jfw::VersionInfo>> const& vecVendorInfos,
|
||||||
std::vector<JavaInfo*> & javaInfosFromPath)
|
std::vector<JavaInfo*> & javaInfosFromPath,
|
||||||
|
std::vector<rtl::Reference<jfw_plugin::VendorBase>> & infos)
|
||||||
{
|
{
|
||||||
// find JREs from PATH
|
// find JREs from PATH
|
||||||
vector<rtl::Reference<VendorBase>> vecInfosFromPath;
|
vector<rtl::Reference<VendorBase>> vecInfosFromPath;
|
||||||
createJavaInfoFromPath(vecInfosFromPath);
|
addJavaInfosFromPath(infos, vecInfosFromPath);
|
||||||
|
|
||||||
vector<rtl::Reference<VendorBase> > vecVerifiedInfos;
|
vector<rtl::Reference<VendorBase> > vecVerifiedInfos;
|
||||||
|
|
||||||
|
@@ -139,23 +139,35 @@ bool decodeOutput(const OString& s, OUString* out);
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
bool getAndAddJREInfoByPath(const OUString& path,
|
bool addJREInfo(
|
||||||
std::vector<rtl::Reference<VendorBase> > & vecInfos)
|
rtl::Reference<VendorBase> const & info,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & infos)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
auto i(
|
||||||
|
std::find_if(
|
||||||
rtl::Reference<VendorBase> aInfo = getJREInfoByPath(path);
|
infos.begin(), infos.end(), InfoFindSame(info->getHome())));
|
||||||
if (aInfo.is())
|
if (i == infos.end()) {
|
||||||
{
|
infos.push_back(info);
|
||||||
ret = true;
|
return true;
|
||||||
vector<rtl::Reference<VendorBase> >::const_iterator it_impl= std::find_if(
|
} else {
|
||||||
vecInfos.begin(),vecInfos.end(), InfoFindSame(aInfo->getHome()));
|
return false;
|
||||||
if(it_impl == vecInfos.end())
|
}
|
||||||
{
|
}
|
||||||
vecInfos.push_back(aInfo);
|
|
||||||
}
|
bool getAndAddJREInfoByPath(
|
||||||
|
const OUString& path,
|
||||||
|
std::vector<rtl::Reference<VendorBase> > & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase> > & addedInfos)
|
||||||
|
{
|
||||||
|
rtl::Reference<VendorBase> aInfo = getJREInfoByPath(path);
|
||||||
|
if (aInfo.is()) {
|
||||||
|
if (addJREInfo(aInfo, allInfos)) {
|
||||||
|
addedInfos.push_back(aInfo);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString getLibraryLocation()
|
OUString getLibraryLocation()
|
||||||
@@ -572,7 +584,9 @@ bool decodeOutput(const OString& s, OUString* out)
|
|||||||
|
|
||||||
|
|
||||||
#if defined WNT
|
#if defined WNT
|
||||||
void createJavaInfoFromWinReg(std::vector<rtl::Reference<VendorBase> > & vecInfos)
|
void addJavaInfoFromWinReg(
|
||||||
|
std::vector<rtl::Reference<VendorBase> > & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase> > & addedInfos)
|
||||||
{
|
{
|
||||||
// Get Java s from registry
|
// Get Java s from registry
|
||||||
std::vector<OUString> vecJavaHome;
|
std::vector<OUString> vecJavaHome;
|
||||||
@@ -583,7 +597,7 @@ void createJavaInfoFromWinReg(std::vector<rtl::Reference<VendorBase> > & vecInfo
|
|||||||
for(ItHome it_home= vecJavaHome.begin(); it_home != vecJavaHome.end();
|
for(ItHome it_home= vecJavaHome.begin(); it_home != vecJavaHome.end();
|
||||||
it_home++)
|
it_home++)
|
||||||
{
|
{
|
||||||
getAndAddJREInfoByPath(*it_home, vecInfos);
|
getAndAddJREInfoByPath(*it_home, allInfos, addedInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,7 +608,7 @@ void createJavaInfoFromWinReg(std::vector<rtl::Reference<VendorBase> > & vecInfo
|
|||||||
for(ItHome it_home= vecJavaHome.begin(); it_home != vecJavaHome.end();
|
for(ItHome it_home= vecJavaHome.begin(); it_home != vecJavaHome.end();
|
||||||
it_home++)
|
it_home++)
|
||||||
{
|
{
|
||||||
getAndAddJREInfoByPath(*it_home, vecInfos);
|
getAndAddJREInfoByPath(*it_home, allInfos, addedInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -736,8 +750,9 @@ void bubbleSortVersion(vector<rtl::Reference<VendorBase> >& vec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void getJREInfoFromBinPath(
|
void addJREInfoFromBinPath(
|
||||||
const OUString& path, vector<rtl::Reference<VendorBase> > & vecInfos)
|
const OUString& path, vector<rtl::Reference<VendorBase>> & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & addedInfos)
|
||||||
{
|
{
|
||||||
// file:///c:/jre/bin
|
// file:///c:/jre/bin
|
||||||
//map: jre/bin/java.exe
|
//map: jre/bin/java.exe
|
||||||
@@ -782,37 +797,41 @@ void getJREInfoFromBinPath(
|
|||||||
sHome = sBinPath.copy(index - 1);
|
sHome = sBinPath.copy(index - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!sHome.isEmpty())
|
if (!sHome.isEmpty()
|
||||||
|
&& getAndAddJREInfoByPath(path, allInfos, addedInfos))
|
||||||
{
|
{
|
||||||
if (getAndAddJREInfoByPath(sHome, vecInfos))
|
return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Reference<VendorBase> > getAllJREInfos()
|
vector<Reference<VendorBase> > addAllJREInfos(
|
||||||
|
bool checkJavaHomeAndPath,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & allInfos)
|
||||||
{
|
{
|
||||||
vector<Reference<VendorBase> > vecInfos;
|
vector<Reference<VendorBase> > addedInfos;
|
||||||
|
|
||||||
#if defined WNT
|
#if defined WNT
|
||||||
// Get Javas from the registry
|
// Get Javas from the registry
|
||||||
createJavaInfoFromWinReg(vecInfos);
|
addJavaInfoFromWinReg(allInfos, addedInfos);
|
||||||
#endif // WNT
|
#endif // WNT
|
||||||
|
|
||||||
#ifndef JVM_ONE_PATH_CHECK
|
#ifndef JVM_ONE_PATH_CHECK
|
||||||
createJavaInfoFromJavaHome(vecInfos);
|
if (checkJavaHomeAndPath) {
|
||||||
//this function should be called after createJavaInfoDirScan.
|
addJavaInfoFromJavaHome(allInfos, addedInfos);
|
||||||
//Otherwise in SDKs Java may be started twice
|
//this function should be called after addJavaInfosDirScan.
|
||||||
createJavaInfoFromPath(vecInfos);
|
//Otherwise in SDKs Java may be started twice
|
||||||
|
addJavaInfosFromPath(allInfos, addedInfos);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef UNX
|
#ifdef UNX
|
||||||
createJavaInfoDirScan(vecInfos);
|
addJavaInfosDirScan(allInfos, addedInfos);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bubbleSortVersion(vecInfos);
|
bubbleSortVersion(addedInfos);
|
||||||
return vecInfos;
|
return addedInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1080,7 +1099,9 @@ inline OUString getDirFromFile(const OUString& usFilePath)
|
|||||||
return usFilePath.copy(0, index);
|
return usFilePath.copy(0, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createJavaInfoFromPath(vector<rtl::Reference<VendorBase> >& vecInfos)
|
void addJavaInfosFromPath(
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & addedInfos)
|
||||||
{
|
{
|
||||||
// Get Java from PATH environment variable
|
// Get Java from PATH environment variable
|
||||||
static const char sCurDir[] = ".";
|
static const char sCurDir[] = ".";
|
||||||
@@ -1119,7 +1140,7 @@ void createJavaInfoFromPath(vector<rtl::Reference<VendorBase> >& vecInfos)
|
|||||||
}
|
}
|
||||||
if(!usBin.isEmpty())
|
if(!usBin.isEmpty())
|
||||||
{
|
{
|
||||||
getJREInfoFromBinPath(usBin, vecInfos);
|
addJREInfoFromBinPath(usBin, allInfos, addedInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1129,7 +1150,9 @@ void createJavaInfoFromPath(vector<rtl::Reference<VendorBase> >& vecInfos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rtl::Reference<VendorBase> getJavaInfoFromJavaHome()
|
void addJavaInfoFromJavaHome(
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & addedInfos)
|
||||||
{
|
{
|
||||||
// Get Java from JAVA_HOME environment
|
// Get Java from JAVA_HOME environment
|
||||||
|
|
||||||
@@ -1144,24 +1167,7 @@ rtl::Reference<VendorBase> getJavaInfoFromJavaHome()
|
|||||||
OUString sHomeUrl;
|
OUString sHomeUrl;
|
||||||
if(File::getFileURLFromSystemPath(sHome, sHomeUrl) == File::E_None)
|
if(File::getFileURLFromSystemPath(sHome, sHomeUrl) == File::E_None)
|
||||||
{
|
{
|
||||||
return getJREInfoByPath(sHomeUrl);
|
getAndAddJREInfoByPath(sHomeUrl, allInfos, addedInfos);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void createJavaInfoFromJavaHome(vector<rtl::Reference<VendorBase> >& vecInfos)
|
|
||||||
{
|
|
||||||
rtl::Reference<VendorBase> aInfo = getJavaInfoFromJavaHome();
|
|
||||||
|
|
||||||
if (aInfo.is())
|
|
||||||
{
|
|
||||||
vector<rtl::Reference<VendorBase> >::const_iterator it_impl= std::find_if(
|
|
||||||
vecInfos.begin(),vecInfos.end(), InfoFindSame(aInfo->getHome()));
|
|
||||||
if(it_impl == vecInfos.end())
|
|
||||||
{
|
|
||||||
vecInfos.push_back(aInfo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1185,25 +1191,31 @@ bool makeDriveLetterSame(OUString * fileURL)
|
|||||||
#ifdef UNX
|
#ifdef UNX
|
||||||
#ifdef SOLARIS
|
#ifdef SOLARIS
|
||||||
|
|
||||||
void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos)
|
void addJavaInfosDirScan(
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & addedInfos)
|
||||||
{
|
{
|
||||||
JFW_TRACE2("Checking /usr/jdk/latest");
|
JFW_TRACE2("Checking /usr/jdk/latest");
|
||||||
getAndAddJREInfoByPath("file:////usr/jdk/latest", vecInfos);
|
getAndAddJREInfoByPath("file:////usr/jdk/latest", allInfos, addedInfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined MACOSX && defined X86_64
|
#elif defined MACOSX && defined X86_64
|
||||||
|
|
||||||
void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos)
|
void addJavaInfosDirScan(
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & addedInfos)
|
||||||
{
|
{
|
||||||
// Oracle Java 7
|
// Oracle Java 7
|
||||||
getAndAddJREInfoByPath("file:///Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home", vecInfos);
|
getAndAddJREInfoByPath("file:///Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home", allInfos, addedInfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos)
|
void addJavaInfosDirScan(
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & addedInfos)
|
||||||
{
|
{
|
||||||
OUString excMessage = "[Java framework] sunjavaplugin: "
|
OUString excMessage = "[Java framework] sunjavaplugin: "
|
||||||
"Error in function createJavaInfoDirScan in util.cxx.";
|
"Error in function addJavaInfosDirScan in util.cxx.";
|
||||||
int cJavaNames= sizeof(g_arJavaNames) / sizeof(char*);
|
int cJavaNames= sizeof(g_arJavaNames) / sizeof(char*);
|
||||||
boost::scoped_array<OUString> sarJavaNames(new OUString[cJavaNames]);
|
boost::scoped_array<OUString> sarJavaNames(new OUString[cJavaNames]);
|
||||||
OUString *arNames = sarJavaNames.get();
|
OUString *arNames = sarJavaNames.get();
|
||||||
@@ -1273,7 +1285,8 @@ void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos)
|
|||||||
}
|
}
|
||||||
JFW_TRACE2("Checking if directory: " << aStatus.getFileURL() << " is a Java");
|
JFW_TRACE2("Checking if directory: " << aStatus.getFileURL() << " is a Java");
|
||||||
|
|
||||||
getAndAddJREInfoByPath(aStatus.getFileURL(),vecInfos);
|
getAndAddJREInfoByPath(
|
||||||
|
aStatus.getFileURL(), allInfos, addedInfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
JFW_ENSURE(errNext == File::E_None || errNext == File::E_NOENT,
|
JFW_ENSURE(errNext == File::E_None || errNext == File::E_NOENT,
|
||||||
@@ -1305,7 +1318,8 @@ void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos)
|
|||||||
&& (islash
|
&& (islash
|
||||||
> RTL_CONSTASCII_LENGTH("file://")))
|
> RTL_CONSTASCII_LENGTH("file://")))
|
||||||
usDir3 = usDir3.copy(0, islash);
|
usDir3 = usDir3.copy(0, islash);
|
||||||
getAndAddJREInfoByPath(usDir3,vecInfos);
|
getAndAddJREInfoByPath(
|
||||||
|
usDir3, allInfos, addedInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,21 +35,25 @@ std::vector<OUString> getVectorFromCharArray(char const * const * ar, int size);
|
|||||||
argument to getJREInfoByPath. For example usBinDir is
|
argument to getJREInfoByPath. For example usBinDir is
|
||||||
file:///c:/j2sdk/jre/bin then file:///c:/j2sdk/jre would be derived.
|
file:///c:/j2sdk/jre/bin then file:///c:/j2sdk/jre would be derived.
|
||||||
*/
|
*/
|
||||||
void getJREInfoFromBinPath(
|
void addJREInfoFromBinPath(
|
||||||
const OUString& path, std::vector<rtl::Reference<VendorBase> > & vecInfos);
|
const OUString& path,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & addedInfos);
|
||||||
inline OUString getDirFromFile(const OUString& usFilePath);
|
inline OUString getDirFromFile(const OUString& usFilePath);
|
||||||
void createJavaInfoFromPath(std::vector<rtl::Reference<VendorBase> >& vecInfos);
|
void addJavaInfosFromPath(
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & addedInfos);
|
||||||
|
|
||||||
/* Returns a VendorBase object if JAVA_HOME environment variable points
|
/* Returns a VendorBase object if JAVA_HOME environment variable points
|
||||||
to a JRE.
|
to a JRE.
|
||||||
*/
|
*/
|
||||||
rtl::Reference<VendorBase> getJavaInfoFromJavaHome();
|
void addJavaInfoFromJavaHome(
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & allInfos,
|
||||||
|
std::vector<rtl::Reference<VendorBase>> & addedInfos);
|
||||||
|
|
||||||
void createJavaInfoFromJavaHome(std::vector<rtl::Reference<VendorBase> > &vecInfos);
|
void addJavaInfosDirScan(
|
||||||
void createJavaInfoDirScan(std::vector<rtl::Reference<VendorBase> >& vecInfos);
|
std::vector<rtl::Reference<VendorBase>> & allInfos,
|
||||||
#ifdef WNT
|
std::vector<rtl::Reference<VendorBase>> & addedInfos);
|
||||||
void createJavaInfoFromWinReg(std::vector<rtl::Reference<VendorBase> >& vecInfos);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool makeDriveLetterSame(OUString * fileURL);
|
bool makeDriveLetterSame(OUString * fileURL);
|
||||||
|
|
||||||
@@ -95,7 +99,8 @@ struct SameOrSubDirJREMap
|
|||||||
*/
|
*/
|
||||||
rtl::Reference<VendorBase> getJREInfoByPath(const OUString& path);
|
rtl::Reference<VendorBase> getJREInfoByPath(const OUString& path);
|
||||||
|
|
||||||
std::vector<rtl::Reference<VendorBase> > getAllJREInfos();
|
std::vector<rtl::Reference<VendorBase> > addAllJREInfos(
|
||||||
|
bool checkJavaHomeAndPath, std::vector<rtl::Reference<VendorBase>> & infos);
|
||||||
|
|
||||||
bool getJavaProps(
|
bool getJavaProps(
|
||||||
const OUString & exePath,
|
const OUString & exePath,
|
||||||
@@ -105,8 +110,6 @@ bool getJavaProps(
|
|||||||
std::vector<std::pair<OUString, OUString> >& props,
|
std::vector<std::pair<OUString, OUString> >& props,
|
||||||
bool * bProcessRun);
|
bool * bProcessRun);
|
||||||
|
|
||||||
void createJavaInfoFromWinReg(std::vector<rtl::Reference<VendorBase> > & vecInfos);
|
|
||||||
|
|
||||||
void bubbleSortVersion(std::vector<rtl::Reference<VendorBase> >& vec);
|
void bubbleSortVersion(std::vector<rtl::Reference<VendorBase> >& vec);
|
||||||
|
|
||||||
rtl::Bootstrap* getBootstrap();
|
rtl::Bootstrap* getBootstrap();
|
||||||
|
@@ -86,14 +86,17 @@ javaFrameworkError SAL_CALL jfw_findAllJREs(JavaInfo ***pparInfo, sal_Int32 *pSi
|
|||||||
//maxVersion and excludeVersions
|
//maxVersion and excludeVersions
|
||||||
sal_Int32 cInfos = 0;
|
sal_Int32 cInfos = 0;
|
||||||
JavaInfo** arInfos = NULL;
|
JavaInfo** arInfos = NULL;
|
||||||
|
std::vector<rtl::Reference<jfw_plugin::VendorBase>> infos;
|
||||||
javaPluginError plerr = jfw_plugin_getAllJavaInfos(
|
javaPluginError plerr = jfw_plugin_getAllJavaInfos(
|
||||||
|
true,
|
||||||
vendor,
|
vendor,
|
||||||
versionInfo.sMinVersion,
|
versionInfo.sMinVersion,
|
||||||
versionInfo.sMaxVersion,
|
versionInfo.sMaxVersion,
|
||||||
versionInfo.getExcludeVersions(),
|
versionInfo.getExcludeVersions(),
|
||||||
versionInfo.getExcludeVersionSize(),
|
versionInfo.getExcludeVersionSize(),
|
||||||
& arInfos,
|
& arInfos,
|
||||||
& cInfos);
|
& cInfos,
|
||||||
|
infos);
|
||||||
|
|
||||||
if (plerr != JFW_PLUGIN_E_NONE)
|
if (plerr != JFW_PLUGIN_E_NONE)
|
||||||
return JFW_E_ERROR;
|
return JFW_E_ERROR;
|
||||||
@@ -408,10 +411,12 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
|
|||||||
std::pair<OUString, jfw::VersionInfo>(vendor, versionInfo));
|
std::pair<OUString, jfw::VersionInfo>(vendor, versionInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<rtl::Reference<jfw_plugin::VendorBase>> infos;
|
||||||
|
|
||||||
// first inspect Java installation that the JAVA_HOME
|
// first inspect Java installation that the JAVA_HOME
|
||||||
// environment variable points to (if it is set)
|
// environment variable points to (if it is set)
|
||||||
JavaInfo* pHomeInfo = NULL;
|
JavaInfo* pHomeInfo = NULL;
|
||||||
if (jfw_plugin_getJavaInfoFromJavaHome(versionInfos, &pHomeInfo)
|
if (jfw_plugin_getJavaInfoFromJavaHome(versionInfos, &pHomeInfo, infos)
|
||||||
== JFW_PLUGIN_E_NONE)
|
== JFW_PLUGIN_E_NONE)
|
||||||
{
|
{
|
||||||
aCurrentInfo = pHomeInfo;
|
aCurrentInfo = pHomeInfo;
|
||||||
@@ -431,7 +436,8 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
|
|||||||
if (!bInfoFound)
|
if (!bInfoFound)
|
||||||
{
|
{
|
||||||
std::vector<JavaInfo*> vecJavaInfosFromPath;
|
std::vector<JavaInfo*> vecJavaInfosFromPath;
|
||||||
if (jfw_plugin_getJavaInfosFromPath(versionInfos, vecJavaInfosFromPath)
|
if (jfw_plugin_getJavaInfosFromPath(
|
||||||
|
versionInfos, vecJavaInfosFromPath, infos)
|
||||||
== JFW_PLUGIN_E_NONE)
|
== JFW_PLUGIN_E_NONE)
|
||||||
{
|
{
|
||||||
std::vector<JavaInfo*>::const_iterator it = vecJavaInfosFromPath.begin();
|
std::vector<JavaInfo*>::const_iterator it = vecJavaInfosFromPath.begin();
|
||||||
@@ -482,13 +488,15 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
|
|||||||
sal_Int32 cInfos = 0;
|
sal_Int32 cInfos = 0;
|
||||||
JavaInfo** arInfos = NULL;
|
JavaInfo** arInfos = NULL;
|
||||||
javaPluginError plerr = jfw_plugin_getAllJavaInfos(
|
javaPluginError plerr = jfw_plugin_getAllJavaInfos(
|
||||||
|
false,
|
||||||
vendor,
|
vendor,
|
||||||
versionInfo.sMinVersion,
|
versionInfo.sMinVersion,
|
||||||
versionInfo.sMaxVersion,
|
versionInfo.sMaxVersion,
|
||||||
versionInfo.getExcludeVersions(),
|
versionInfo.getExcludeVersions(),
|
||||||
versionInfo.getExcludeVersionSize(),
|
versionInfo.getExcludeVersionSize(),
|
||||||
& arInfos,
|
& arInfos,
|
||||||
& cInfos);
|
& cInfos,
|
||||||
|
infos);
|
||||||
|
|
||||||
if (plerr != JFW_PLUGIN_E_NONE)
|
if (plerr != JFW_PLUGIN_E_NONE)
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user