Kaydet (Commit) a4de06e4 authored tarafından Kurt Zenker's avatar Kurt Zenker

INTEGRATION: CWS jl15 (1.4.2); FILE MERGED

2004/11/30 13:49:32 jl 1.4.2.4: #i37827# a trace message contained the word error which made the build in instset_native stop
2004/11/29 16:03:21 jl 1.4.2.3: #i36958# typo in trace message
2004/11/26 11:17:20 jl 1.4.2.2: #i36958# executing java occurs without setting a security handle
2004/11/24 12:41:04 jl 1.4.2.1: #i37225#
üst 64d391b5
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: util.cxx,v $ * $RCSfile: util.cxx,v $
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* *
* last change: $Author: hr $ $Date: 2004-11-09 13:59:18 $ * last change: $Author: kz $ $Date: 2004-12-16 11:45:40 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -79,11 +79,12 @@ ...@@ -79,11 +79,12 @@
#include "sunjre.hxx" #include "sunjre.hxx"
#include "vendorlist.hxx" #include "vendorlist.hxx"
#include "diagnostics.h"
using namespace rtl; using namespace rtl;
using namespace osl; using namespace osl;
using namespace std; using namespace std;
;
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
#ifdef WNT #ifdef WNT
#define HKEY_SUN_JRE L"Software\\JavaSoft\\Java Runtime Environment" #define HKEY_SUN_JRE L"Software\\JavaSoft\\Java Runtime Environment"
#define HKEY_SUN_SDK L"Software\\JavaSoft\\Java Development Kit" #define HKEY_SUN_SDK L"Software\\JavaSoft\\Java Development Kit"
...@@ -349,12 +350,14 @@ bool getJavaProps(const OUString & exePath, ...@@ -349,12 +350,14 @@ bool getJavaProps(const OUString & exePath,
FileHandleReader stdoutReader(fileOut); FileHandleReader stdoutReader(fileOut);
AsynchReader stderrReader(fileErr); AsynchReader stderrReader(fileErr);
JFW_TRACE2(OUSTR("\n[Java framework] Executing: ") + exePath + OUSTR(".\n"));
oslProcessError procErr = oslProcessError procErr =
osl_executeProcess_WithRedirectedIO( exePath.pData,//usExe.pData, osl_executeProcess_WithRedirectedIO( exePath.pData,//usExe.pData,
args, args,
3, //sal_uInt32 nArguments, 3, //sal_uInt32 nArguments,
osl_Process_HIDDEN, //oslProcessOption Options, osl_Process_HIDDEN, //oslProcessOption Options,
Security().getHandle(), //oslSecurity Security, NULL, //oslSecurity Security,
usStartDir.pData,//usStartDir.pData,//usWorkDir.pData, //rtl_uString *strWorkDir, usStartDir.pData,//usStartDir.pData,//usWorkDir.pData, //rtl_uString *strWorkDir,
NULL, //rtl_uString *strEnvironment[], NULL, //rtl_uString *strEnvironment[],
0, // sal_uInt32 nEnvironmentVars, 0, // sal_uInt32 nEnvironmentVars,
...@@ -365,11 +368,13 @@ bool getJavaProps(const OUString & exePath, ...@@ -365,11 +368,13 @@ bool getJavaProps(const OUString & exePath,
if( procErr != osl_Process_E_None) if( procErr != osl_Process_E_None)
{ {
JFW_TRACE2("[Java framework] Execution failed. \n");
*bProcessRun = false; *bProcessRun = false;
return ret; return ret;
} }
else else
{ {
JFW_TRACE2("[Java framework] Java executed successfully.\n");
*bProcessRun = true; *bProcessRun = true;
} }
...@@ -402,11 +407,8 @@ bool getJavaProps(const OUString & exePath, ...@@ -402,11 +407,8 @@ bool getJavaProps(const OUString & exePath,
//process error stream data //process error stream data
stderrReader.join(); stderrReader.join();
#if OSL_DEBUG_LEVEL >=2 JFW_TRACE2(OString("[Java framework] Java wrote to stderr:\" ")
OString data = stderrReader.getData(); + stderrReader.getData() + OString(" \".\n"));
fprintf(stderr,"%s\n", data.getStr());
#endif
TimeValue waitMax= {5 ,0}; TimeValue waitMax= {5 ,0};
procErr = osl_joinProcessWithTimeout(javaProcess, &waitMax); procErr = osl_joinProcessWithTimeout(javaProcess, &waitMax);
...@@ -686,105 +688,6 @@ vector<Reference<VendorBase> > getAllJREInfos() ...@@ -686,105 +688,6 @@ vector<Reference<VendorBase> > getAllJREInfos()
} }
std::vector<rtl::Reference<VendorBase> > getAllJREInfos(
const rtl::OUString& sVendor,
const rtl::OUString& sMinVersion,
const rtl::OUString& sMaxVersion,
const std::vector<rtl::OUString> & vecExcludeVersions)
{
vector<rtl::Reference<VendorBase> > ret;
vector<rtl::Reference<VendorBase> > vecInfos =
getAllJREInfos();
bool bVendor = sVendor.getLength() > 0 ? true : false;
bool bMinVersion = sMinVersion.getLength() > 0 ? true : false;
bool bMaxVersion = sMaxVersion.getLength() > 0 ? true : false;
bool bExcludeList = vecExcludeVersions.size() > 0 ? true : false;
typedef vector<rtl::Reference<VendorBase> >::iterator it;
for (it i= vecInfos.begin(); i != vecInfos.end(); i++)
{
rtl::Reference<VendorBase>& cur = *i;
if (bVendor)
{
if (sVendor.equals(cur->getVendor()) == sal_False)
continue;
}
if (bMinVersion)
{
try
{
if (cur->compareVersions(sMinVersion) == -1)
continue;
}
catch (MalformedVersionException&)
{
#if OSL_DEBUG_LEVEL >= 1
OString _ver = OUStringToOString(
cur->getVersion(), osl_getThreadTextEncoding());
fprintf(stderr, "sunjavaplugin: A JRE was detected which version "
"has an unknown format: %s",_ver.getStr());
#endif
continue;
}
}
if (bMaxVersion)
{
try
{
if (cur->compareVersions(sMaxVersion) == 1)
continue;
}
catch (MalformedVersionException&)
{
#if OSL_DEBUG_LEVEL >= 1
OString _ver = OUStringToOString(
cur->getVersion(), osl_getThreadTextEncoding());
fprintf(stderr, "sunjavaplugin: A JRE was detected which version "
"has an unknown format: %s",_ver.getStr());
#endif
continue;
}
}
if (bExcludeList)
{
bool bExclude = false;
typedef vector<OUString>::const_iterator it_s;
for (it_s ii = vecExcludeVersions.begin();
ii != vecExcludeVersions.end(); ii++)
{
try
{
if (cur->compareVersions(*ii) == 0)
{
bExclude = true;
break;
}
}
catch (MalformedVersionException&)
{
#if OSL_DEBUG_LEVEL >= 1
OString _ver = OUStringToOString(
cur->getVersion(), osl_getThreadTextEncoding());
fprintf(stderr, "sunjavaplugin: A JRE was detected which version "
"has an unknown format: %s",_ver.getStr());
#endif
bExclude = true;
break;
}
}
if (bExclude == true)
continue;
}
ret.push_back(*i);
}
return ret;
}
vector<OUString> getVectorFromCharArray(char const * const * ar, int size) vector<OUString> getVectorFromCharArray(char const * const * ar, int size)
{ {
vector<OUString> vec; vector<OUString> vec;
...@@ -923,10 +826,9 @@ rtl::Reference<VendorBase> getJREInfoByPath( ...@@ -923,10 +826,9 @@ rtl::Reference<VendorBase> getJREInfoByPath(
SameOrSubDirJREMap(sResolvedDir)); SameOrSubDirJREMap(sResolvedDir));
if (entry2 != mapJREs.end()) if (entry2 != mapJREs.end())
{ {
#if OSL_DEBUG_LEVEL >= 2 JFW_TRACE2(OUSTR("[Java framework] sunjavaplugin"SAL_DLLEXTENSION ": ")
OString _s = OUStringToOString(sResolvedDir, osl_getThreadTextEncoding()); + OUSTR("JRE found again (detected before): ") + sResolvedDir
fprintf(stderr,"###JRE found again (detected before): %s\n", _s.getStr()); + OUSTR(".\n"));
#endif
return entry2->second; return entry2->second;
} }
...@@ -978,10 +880,9 @@ rtl::Reference<VendorBase> getJREInfoByPath( ...@@ -978,10 +880,9 @@ rtl::Reference<VendorBase> getJREInfoByPath(
MapIt entry = mapJREs.find(sFilePath); MapIt entry = mapJREs.find(sFilePath);
if (entry != mapJREs.end()) if (entry != mapJREs.end())
{ {
#if OSL_DEBUG_LEVEL >= 2 JFW_TRACE2(OUSTR("[Java framework] sunjavaplugin"SAL_DLLEXTENSION ": ")
OString _s = OUStringToOString(sFilePath, osl_getThreadTextEncoding()); + OUSTR("JRE found again (detected before): ") + sFilePath
fprintf(stderr,"###JRE found again (detected before): %s\n", _s.getStr()); + OUSTR(".\n"));
#endif
return entry->second; return entry->second;
} }
...@@ -1047,12 +948,10 @@ rtl::Reference<VendorBase> getJREInfoByPath( ...@@ -1047,12 +948,10 @@ rtl::Reference<VendorBase> getJREInfoByPath(
vecBadPaths.push_back(sResolvedDir); vecBadPaths.push_back(sResolvedDir);
else else
{ {
#if OSL_DEBUG_LEVEL >= 2 JFW_TRACE2(OUSTR("[Java framework] sunjavaplugin"SAL_DLLEXTENSION ": ")
OString _s = OUStringToOString(sResolvedDir, osl_getThreadTextEncoding()); + OUSTR("Detected another JRE: ") + sResolvedDir
OString _s2 = OUStringToOString(path, osl_getThreadTextEncoding()); + OUSTR(" \n at: ") + path + OUSTR(".\n"));
fprintf(stderr,"###Detected another JRE: %s\n at: %s\n" ,
_s.getStr(), _s2.getStr());
#endif
mapJREs.insert(MAPJRE::value_type(sResolvedDir, ret)); mapJREs.insert(MAPJRE::value_type(sResolvedDir, ret));
mapJREs.insert(MAPJRE::value_type(sFilePath, ret)); mapJREs.insert(MAPJRE::value_type(sFilePath, ret));
} }
......
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