diff options
Diffstat (limited to 'jvmfwk/plugins/sunmajor/pluginlib/util.cxx')
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 75c1a96de7bf..3612169e6ed3 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -74,11 +74,11 @@ using namespace std; namespace { char const *g_arJavaNames[] = { "", - "j2re", - "j2se", + "j2re", + "j2se", "j2sdk", "jdk", - "jre", + "jre", "java", "Home", "IBMJava2-ppc-142" @@ -87,11 +87,11 @@ char const *g_arJavaNames[] = { */ char const *g_arCollectDirs[] = { "", - "j2re/", - "j2se/", + "j2re/", + "j2se/", "j2sdk/", "jdk/", - "jre/", + "jre/", "java/", "jvm/" }; @@ -133,7 +133,7 @@ namespace { rtl::OUString getLibraryLocation() { - rtl::OUString libraryFileUrl; + rtl::OUString libraryFileUrl; OSL_VERIFY(osl::Module::getUrlFromAddress((void *)(sal_IntPtr)getLibraryLocation, libraryFileUrl)); return getDirFromFile(libraryFileUrl); } @@ -144,7 +144,7 @@ namespace { static rtl::Bootstrap aInstance(sIni); return & aInstance; - + } }; @@ -289,7 +289,7 @@ class AsynchReader: public Thread { size_t m_nDataSize; boost::scoped_array<sal_Char> m_arData; - + bool m_bError; bool m_bDone; FileHandleGuard m_aGuard; @@ -302,7 +302,7 @@ public: /** only call this function after this thread has finished. That is, call join on this instance and then call getData. - + */ OString getData(); #endif @@ -335,12 +335,12 @@ void AsynchReader::run() case osl_File_E_PIPE: //HACK! for windows nRead = 0; case osl_File_E_None: - break; + break; default: m_bError = true; return; } - + if (nRead == 0) { m_bDone = true; @@ -390,7 +390,7 @@ bool getJavaProps(const OUString & exePath, //that it calls java.awt.Toolkit.getDefaultToolkit(); OUString sValue; getBootstrap()->getFrom(OUSTR("JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY"), sValue); - + //prepare the arguments sal_Int32 cArgs = 3; OUString arg1 = OUString(RTL_CONSTASCII_USTRINGPARAM("-classpath"));// + sClassPath; @@ -405,7 +405,7 @@ bool getJavaProps(const OUString & exePath, args[3] = arg4.pData; cArgs = 4; } - + oslProcess javaProcess= 0; oslFileHandle fileOut= 0; oslFileHandle fileErr= 0; @@ -477,7 +477,7 @@ bool getJavaProps(const OUString & exePath, stderrReader.join(); JFW_TRACE2(OString("[Java framework] Java wrote to stderr:\" ") + stderrReader.getData() + OString(" \".\n")); - + TimeValue waitMax= {5 ,0}; procErr = osl_joinProcessWithTimeout(javaProcess, &waitMax); OSL_ASSERT(procErr == osl_Process_E_None); @@ -544,7 +544,7 @@ void createJavaInfoFromWinReg(std::vector<rtl::Reference<VendorBase> > & vecInfo } -bool getJavaInfoFromRegistry(const wchar_t* szRegKey, +bool getJavaInfoFromRegistry(const wchar_t* szRegKey, vector<OUString>& vecJavaHome) { HKEY hRoot; @@ -554,8 +554,8 @@ bool getJavaInfoFromRegistry(const wchar_t* szRegKey, DWORD dwIndex = 0; const DWORD BUFFSIZE = 1024; wchar_t bufVersion[BUFFSIZE]; -// char bufVersion[BUFFSIZE]; - DWORD nNameLen = BUFFSIZE; +// char bufVersion[BUFFSIZE]; + DWORD nNameLen = BUFFSIZE; FILETIME fileTime; nNameLen = sizeof(bufVersion); @@ -648,7 +648,7 @@ void bubbleSortVersion(vector<rtl::Reference<VendorBase> >& vec) // valid version //check if version of current is recognized, by comparing it with itself - try + try { cur->compareVersions(cur->getVersion()); } @@ -660,13 +660,13 @@ void bubbleSortVersion(vector<rtl::Reference<VendorBase> >& vec) if (nCmp == 0) { try - { + { nCmp = cur->compareVersions(next->getVersion()); } catch (MalformedVersionException & ) { //The second version is invalid, therefor it is regardes less. - nCmp = 1; + nCmp = 1; } } if(nCmp == 1) // cur > next @@ -722,7 +722,7 @@ bool getJREInfoFromBinPath( // jre/bin/jre -> jre/bin OUString sMapPath(i->getStr(), index); index = sBinPath.lastIndexOf(sMapPath); - if (index != -1 + if (index != -1 && (index + sMapPath.getLength() == sBinPath.getLength()) && sBinPath[index - 1] == '/') { @@ -764,7 +764,7 @@ vector<Reference<VendorBase> > getAllJREInfos() return vecInfos; } - + vector<OUString> getVectorFromCharArray(char const * const * ar, int size) { vector<OUString> vec; @@ -779,7 +779,7 @@ bool getJREInfoByPath(const rtl::OUString& path, std::vector<rtl::Reference<VendorBase> > & vecInfos) { bool ret = false; - + rtl::Reference<VendorBase> aInfo = getJREInfoByPath(path); if (aInfo.is()) { @@ -814,7 +814,7 @@ OUString resolveDirPath(const OUString & path) FileStatus status(FileStatusMask_Type | FileStatusMask_LinkTargetURL | FileStatusMask_FileURL); - + if (item.getFileStatus(status) == File::E_None && status.getFileType() == FileStatus::Directory) { @@ -826,7 +826,7 @@ OUString resolveDirPath(const OUString & path) return ret; } /** Checks if the path is a file. If it is a link to a file than - it is resolved. + it is resolved. */ OUString resolveFilePath(const OUString & path) { @@ -848,11 +848,11 @@ OUString resolveFilePath(const OUString & path) && status.getFileType() == FileStatus::Regular) { ret = sResolved; - } + } } else return OUString(); - + return ret; } @@ -873,7 +873,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( // If this path is invalid then there is no chance to find a JRE here if (sResolvedDir.getLength() == 0) return 0; - + //check if the directory path is good, that is a JRE was already recognized. //Then we need not detect it again //For example, a sun JKD contains <jdk>/bin/java and <jdk>/jre/bin/java. @@ -884,7 +884,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( if (entry2 != mapJREs.end()) { JFW_TRACE2(OUSTR("[Java framework] sunjavaplugin"SAL_DLLEXTENSION ": ") - + OUSTR("JRE found again (detected before): ") + sResolvedDir + + OUSTR("JRE found again (detected before): ") + sResolvedDir + OUSTR(".\n")); return entry2->second; } @@ -905,7 +905,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( { //if the path is a link, then resolve it //check if the executable exists at all - + //path can be only "file:///". Then do not append a '/' //sizeof counts the terminating 0 OUString sFullPath; @@ -917,7 +917,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( sFilePath = resolveFilePath(sFullPath); - + if (sFilePath.getLength() == 0) { //The file path (to java exe) is not valid @@ -935,7 +935,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( if (entry != mapJREs.end()) { JFW_TRACE2(OUSTR("[Java framework] sunjavaplugin"SAL_DLLEXTENSION ": ") - + OUSTR("JRE found again (detected before): ") + sFilePath + + OUSTR("JRE found again (detected before): ") + sFilePath + OUSTR(".\n")); return entry->second; @@ -962,7 +962,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( //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); - // Either we found a working 1.3.1 + // 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; break; @@ -988,12 +988,12 @@ rtl::Reference<VendorBase> getJREInfoByPath( if (props.size() == 0) return rtl::Reference<VendorBase>(); - + //find java.vendor property typedef vector<pair<OUString, OUString> >::const_iterator c_ip; OUString sVendor(RTL_CONSTASCII_USTRINGPARAM("java.vendor")); OUString sVendorName; - + for (c_ip i = props.begin(); i != props.end(); i++) { if (sVendor.equals(i->first)) @@ -1002,9 +1002,9 @@ rtl::Reference<VendorBase> getJREInfoByPath( break; } } - + if (sVendorName.getLength() > 0) - { + { //find the creator func for the respective vendor name for ( sal_Int32 c = 0; gVendorMap[c].sVendorName != NULL; ++c ) @@ -1017,17 +1017,17 @@ rtl::Reference<VendorBase> getJREInfoByPath( break; } } - } + } if (ret.is() == false) vecBadPaths.push_back(sFilePath); else { JFW_TRACE2(OUSTR("[Java framework] sunjavaplugin"SAL_DLLEXTENSION ": ") - + OUSTR("Found JRE: ") + sResolvedDir + + OUSTR("Found JRE: ") + sResolvedDir + OUSTR(" \n at: ") + path + OUSTR(".\n")); - + mapJREs.insert(MAPJRE::value_type(sResolvedDir, ret)); - mapJREs.insert(MAPJRE::value_type(sFilePath, ret)); + mapJREs.insert(MAPJRE::value_type(sFilePath, ret)); } return ret; @@ -1036,7 +1036,7 @@ rtl::Reference<VendorBase> getJREInfoByPath( Reference<VendorBase> createInstance(createInstance_func pFunc, vector<pair<OUString, OUString> > properties) { - + Reference<VendorBase> aBase = (*pFunc)(); if (aBase.is()) { @@ -1137,7 +1137,7 @@ bool makeDriveLetterSame(OUString * fileURL) void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos) { JFW_TRACE2(OUSTR("\n[Java framework] Checking \"/usr/jdk/latest\"\n")); - getJREInfoByPath(OUSTR("file:////usr/jdk/latest"), vecInfos); + getJREInfoByPath(OUSTR("file:////usr/jdk/latest"), vecInfos); } #else @@ -1166,7 +1166,7 @@ void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos) arCollectDirs[d] = OUString(g_arCollectDirs[d], strlen(g_arCollectDirs[d]), RTL_TEXTENCODING_UTF8); - + OUString usFile(RTL_CONSTASCII_USTRINGPARAM("file:///")); for( int ii = 0; ii < cSearchPaths; ii ++) @@ -1224,7 +1224,7 @@ void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos) getJREInfoByPath(aStatus.getFileURL(),vecInfos); } - + JFW_ENSURE(errNext == File::E_None || errNext == File::E_NOENT, OUSTR("[Java framework] sunjavaplugin: " "Error while iterating over contens of ") @@ -1244,7 +1244,7 @@ void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos) { // /usr/java/j2re1.4.0 OUString usDir3(usDir2 + arNames[k]); - + DirectoryItem item3; if(DirectoryItem::get(usDir3, item) == File::E_None) { |