summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/makefile.mk4
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util.cxx40
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util.hxx3
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx5
4 files changed, 50 insertions, 2 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk b/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk
index 4fdb1ba92567..76fd7c973394 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk
+++ b/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk
@@ -73,6 +73,10 @@ SHL1STDLIBS += -luwinapi -ladvapi32
.ENDIF # GCC
.ENDIF #WNT
+.IF "$(JVM_ONE_PATH_CHECK)" != ""
+CFLAGS += -DJVM_ONE_PATH_CHECK=\"$(JVM_ONE_PATH_CHECK)\"
+.ENDIF
+
SHL1VERSIONMAP = sunjavaplugin.map
SHL1DEPN=
SHL1IMPLIB= i$(UNOCOMPONENT1)
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index f3f64a806d5c..4ed3f21e0216 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -92,12 +92,14 @@ char const *g_arJavaNames[] = {
*/
char const *g_arCollectDirs[] = {
"",
+#ifndef JVM_ONE_PATH_CHECK
"j2re/",
"j2se/",
"j2sdk/",
"jdk/",
"jre/",
"java/",
+#endif
"jvm/"
};
@@ -109,6 +111,7 @@ char const *g_arSearchPaths[] = {
"",
"System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/"
#else
+#ifndef JVM_ONE_PATH_CHECK
"",
"usr/",
"usr/local/",
@@ -119,6 +122,9 @@ char const *g_arSearchPaths[] = {
#endif
"usr/lib/",
"usr/bin/"
+#else
+ JVM_ONE_PATH_CHECK
+#endif
#endif
};
}
@@ -368,6 +374,9 @@ void AsynchReader::run()
bool getJavaProps(const OUString & exePath,
+#ifdef JVM_ONE_PATH_CHECK
+ const OUString & homePath,
+#endif
std::vector<std::pair<rtl::OUString, rtl::OUString> >& props,
bool * bProcessRun)
{
@@ -469,6 +478,15 @@ bool getJavaProps(const OUString & exePath,
OUString sKey = sLine.copy(0, index);
OUString sVal = sLine.copy(index + 1);
+#ifdef JVM_ONE_PATH_CHECK
+ //replace absolute path by linux distro link
+ OUString sHomeProperty(RTL_CONSTASCII_USTRINGPARAM("java.home"));
+ if(sHomeProperty.equals(sKey))
+ {
+ sVal = homePath + OUString::createFromAscii("/jre");
+ }
+#endif
+
props.push_back(std::make_pair(sKey, sVal));
}
@@ -751,10 +769,12 @@ vector<Reference<VendorBase> > getAllJREInfos()
createJavaInfoFromWinReg(vecInfos);
#endif // WNT
+#ifndef JVM_ONE_PATH_CHECK
createJavaInfoFromJavaHome(vecInfos);
//this function should be called after createJavaInfoDirScan.
//Otherwise in SDKs Java may be started twice
createJavaInfoFromPath(vecInfos);
+#endif
#ifdef UNX
createJavaInfoDirScan(vecInfos);
@@ -818,7 +838,11 @@ OUString resolveDirPath(const OUString & path)
if (item.getFileStatus(status) == File::E_None
&& status.getFileType() == FileStatus::Directory)
{
+#ifndef JVM_ONE_PATH_CHECK
ret = sResolved;
+#else
+ ret = path;
+#endif
}
}
else
@@ -847,7 +871,11 @@ OUString resolveFilePath(const OUString & path)
if (item.getFileStatus(status) == File::E_None
&& status.getFileType() == FileStatus::Regular)
{
+#ifndef JVM_ONE_PATH_CHECK
ret = sResolved;
+#else
+ ret = path;
+#endif
}
}
else
@@ -942,7 +970,11 @@ rtl::Reference<VendorBase> getJREInfoByPath(
}
bool bProcessRun= false;
- if (getJavaProps(sFilePath, props, & bProcessRun) == false)
+ if (getJavaProps(sFilePath,
+#ifdef JVM_ONE_PATH_CHECK
+ sResolvedDir,
+#endif
+ props, & bProcessRun) == false)
{
//The java executable could not be run or the system properties
//could not be retrieved. We can assume that this java is corrupt.
@@ -961,7 +993,11 @@ rtl::Reference<VendorBase> getJREInfoByPath(
//invoked to build the path to the executable. It we start the script directy as .java_wrapper
//then it tries to start a jdk/.../native_threads/.java_wrapper. Therefore the link, which
//is named java, must be used to start the script.
- getJavaProps(sFullPath, props, & bProcessRun);
+ getJavaProps(sFullPath,
+#ifdef JVM_ONE_PATH_CHECK
+ sResolvedDir,
+#endif
+ props, & bProcessRun);
// Either we found a working 1.3.1
//Or the java is broken. In both cases we stop searchin under this "root" directory
bBreak = true;
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.hxx b/jvmfwk/plugins/sunmajor/pluginlib/util.hxx
index eedd51c16e33..891ad63a58bc 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.hxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.hxx
@@ -118,6 +118,9 @@ std::vector<rtl::Reference<VendorBase> > getAllJREInfos();
bool getJavaProps(
const rtl::OUString & exePath,
+#ifdef JVM_ONE_PATH_CHECK
+ const rtl::OUString & homePath,
+#endif
std::vector<std::pair<rtl::OUString, rtl::OUString> >& props,
bool * bProcessRun);
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx
index 75f0f973ac16..3e5cf8ad5be0 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx
@@ -131,6 +131,7 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
}
else if (!bHome && sHomeProperty.equals(i->first))
{
+#ifndef JVM_ONE_PATH_CHECK
OUString fileURL;
if (osl_getFileURLFromSystemPath(i->second.pData,& fileURL.pData) ==
osl_File_E_None)
@@ -144,6 +145,10 @@ bool VendorBase::initialize(vector<pair<OUString, OUString> > props)
bHome = true;
}
}
+#else
+ m_sHome = i->second;
+ bHome = true;
+#endif
}
else if (!bAccess && sAccessProperty.equals(i->first))
{