From c47f3523338b8e58c1ea18cc583064761f60df90 Mon Sep 17 00:00:00 2001 From: Gustavo Buzzatti Pacheco Date: Wed, 4 Jan 2012 11:38:41 -0200 Subject: Fix for fdo43460 Part XXII getLength() to isEmpty() Part XXII modules jvmfwk, l10ntools, lingucomponent --- jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx | 8 +++--- .../plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 30 +++++++++++----------- jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 18 ++++++------- jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx | 8 +++--- jvmfwk/source/elements.cxx | 8 +++--- jvmfwk/source/framework.cxx | 4 +-- jvmfwk/source/fwkbase.cxx | 28 ++++++++++---------- 7 files changed, 52 insertions(+), 52 deletions(-) (limited to 'jvmfwk') diff --git a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx index 53ac6932e5dc..628461c406ef 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx @@ -164,7 +164,7 @@ bool GnuInfo::initialize(vector > props) } else if (!bAccess && sAccessProperty.equals(i->first)) { - if (i->second.getLength() > 0) + if (!i->second.isEmpty()) { m_bAccessibility = true; bAccess = true; @@ -177,11 +177,11 @@ bool GnuInfo::initialize(vector > props) if (!bVersion || !bVendor || !bHome) return false; - if (!m_sJavaHome.getLength()) + if (m_sJavaHome.isEmpty()) m_sJavaHome = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///usr/lib")); // init m_sRuntimeLibrary - OSL_ASSERT(m_sHome.getLength()); + OSL_ASSERT(!m_sHome.isEmpty()); //call virtual function to get the possible paths to the runtime library. int size = 0; @@ -266,7 +266,7 @@ bool GnuInfo::initialize(vector > props) return false; // init m_sLD_LIBRARY_PATH - OSL_ASSERT(m_sHome.getLength()); + OSL_ASSERT(!m_sHome.isEmpty()); size = 0; char const * const * arLDPaths = getLibraryPaths( & size); vector ld_paths = getVectorFromCharArray(arLDPaths, size); diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index d70338fe5615..08577c0647db 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -116,7 +116,7 @@ OString getPluginJarPath( //but this does not harm. 1.5.0-beta < 1.5.0 sName = sName2; } - if (sName.getLength()) + if (!sName.isEmpty()) { sName = sLocation + OUSTR("/lib/") + sName; OSL_VERIFY( @@ -140,7 +140,7 @@ OString getPluginJarPath( sPath = sPath1 + OUString::createFromAscii(sep) + sPath2; } } - OSL_ASSERT(sPath.getLength()); + OSL_ASSERT(!sPath.isEmpty()); } ret = rtl::OUStringToOString(sPath, osl_getThreadTextEncoding()); @@ -167,7 +167,7 @@ JavaInfo* createJavaInfo(const rtl::Reference & info) pInfo->nRequirements = info->needsRestart() ? JFW_REQUIRE_NEEDRESTART : 0; rtl::OUStringBuffer buf(1024); buf.append(info->getRuntimeLibrary()); - if (info->getLibraryPaths().getLength() > 0) + if (!info->getLibraryPaths().isEmpty()) { buf.appendAscii("\n"); buf.append(info->getLibraryPaths()); @@ -239,8 +239,8 @@ javaPluginError jfw_plugin_getAllJavaInfos( OUString ouMinVer(sMinVersion); OUString ouMaxVer(sMaxVersion); - OSL_ASSERT(ouVendor.getLength() > 0); - if (ouVendor.getLength() == 0) + OSL_ASSERT(!ouVendor.isEmpty()); + if (ouVendor.isEmpty()) return JFW_PLUGIN_E_INVALID_ARG; JavaInfo** arInfo = NULL; @@ -258,7 +258,7 @@ javaPluginError jfw_plugin_getAllJavaInfos( if (ouVendor.equals(cur->getVendor()) == sal_False) continue; - if (ouMinVer.getLength() > 0) + if (!ouMinVer.isEmpty()) { try { @@ -276,7 +276,7 @@ javaPluginError jfw_plugin_getAllJavaInfos( } } - if (ouMaxVer.getLength() > 0) + if (!ouMaxVer.isEmpty()) { try { @@ -358,8 +358,8 @@ javaPluginError jfw_plugin_getJavaInfoByPath( if (!path || !sVendor || !sMinVersion || !sMaxVersion || !ppInfo) return JFW_PLUGIN_E_INVALID_ARG; OUString ouPath(path); - OSL_ASSERT(ouPath.getLength() > 0); - if (ouPath.getLength() == 0) + OSL_ASSERT(!ouPath.isEmpty()); + if (ouPath.isEmpty()) return JFW_PLUGIN_E_INVALID_ARG; //nLenlist contains the number of element in arExcludeList. @@ -372,8 +372,8 @@ javaPluginError jfw_plugin_getJavaInfoByPath( OUString ouMinVer(sMinVersion); OUString ouMaxVer(sMaxVersion); - OSL_ASSERT(ouVendor.getLength() > 0); - if (ouVendor.getLength() == 0) + OSL_ASSERT(!ouVendor.isEmpty()); + if (ouVendor.isEmpty()) return JFW_PLUGIN_E_INVALID_ARG; rtl::Reference aVendorInfo = getJREInfoByPath(ouPath); @@ -384,7 +384,7 @@ javaPluginError jfw_plugin_getJavaInfoByPath( if (ouVendor.equals(aVendorInfo->getVendor()) == sal_False) return JFW_PLUGIN_E_NO_JRE; - if (ouMinVer.getLength() > 0) + if (!ouMinVer.isEmpty()) { int nRes = 0; try @@ -404,7 +404,7 @@ javaPluginError jfw_plugin_getJavaInfoByPath( return JFW_PLUGIN_E_FAILED_VERSION; } - if (ouMaxVer.getLength() > 0) + if (!ouMaxVer.isEmpty()) { int nRes = 0; try @@ -676,7 +676,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( { char sep[] = {SAL_PATHSEPARATOR, 0}; OString sAddPath = getPluginJarPath(pInfo->sVendor, pInfo->sLocation,pInfo->sVersion); - if (sAddPath.getLength()) + if (!sAddPath.isEmpty()) sClassPathOption = sClassPath + rtl::OString(sep) + sAddPath; else sClassPathOption = sClassPath; @@ -776,7 +776,7 @@ javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist) return JFW_PLUGIN_E_INVALID_ARG; ::rtl::OUString sLocation(pInfo->sLocation); - if (sLocation.getLength() == 0) + if (sLocation.isEmpty()) return JFW_PLUGIN_E_INVALID_ARG; ::osl::DirectoryItem item; ::osl::File::RC rc_item = ::osl::DirectoryItem::get(sLocation, item); diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 947022f04aea..d541bea22816 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -378,7 +378,7 @@ bool getJavaProps(const OUString & exePath, { bool ret = false; - OSL_ASSERT( exePath.getLength() > 0); + OSL_ASSERT(!exePath.isEmpty()); OUString usStartDir; //We need to set the CLASSPATH in case the office is started from //a different directory. The JREProperties.class is expected to reside @@ -465,7 +465,7 @@ bool getJavaProps(const OUString & exePath, continue; JFW_TRACE2("[Java framework]:\" " << sLine << " \".\n"); sLine = sLine.trim(); - if (sLine.getLength() == 0) + if (sLine.isEmpty()) continue; //The JREProperties class writes key value pairs, separated by '=' sal_Int32 index = sLine.indexOf('=', 0); @@ -512,7 +512,7 @@ bool decodeOutput(const rtl::OString& s, rtl::OUString* out) do { OString aToken = s.getToken( 0, ' ', nIndex ); - if (aToken.getLength()) + if (!aToken.isEmpty()) { for (sal_Int32 i = 0; i < aToken.getLength(); ++i) { @@ -742,7 +742,7 @@ bool getJREInfoFromBinPath( sHome = OUString(sBinPath.getStr(), index - 1); } } - if (sHome.getLength() > 0) + if (!sHome.isEmpty()) { ret = getJREInfoByPath(sHome, vecInfos); if (ret) @@ -870,7 +870,7 @@ rtl::Reference getJREInfoByPath( OUString sResolvedDir = resolveDirPath(path); // If this path is invalid then there is no chance to find a JRE here - if (sResolvedDir.getLength() == 0) + if (sResolvedDir.isEmpty()) return 0; //check if the directory path is good, that is a JRE was already recognized. @@ -917,7 +917,7 @@ rtl::Reference getJREInfoByPath( sFilePath = resolveFilePath(sFullPath); - if (sFilePath.getLength() == 0) + if (sFilePath.isEmpty()) { //The file path (to java exe) is not valid cit_path ifull = find(vecBadPaths.begin(), vecBadPaths.end(), sFullPath); @@ -1010,7 +1010,7 @@ rtl::Reference getJREInfoByPath( } } - if (sVendorName.getLength() > 0) + if (!sVendorName.isEmpty()) { //find the creator func for the respective vendor name for ( sal_Int32 c = 0; @@ -1075,7 +1075,7 @@ void createJavaInfoFromPath(vector >& vecInfos) OUString usTokenUrl; if(File::getFileURLFromSystemPath(usToken, usTokenUrl) == File::E_None) { - if(usTokenUrl.getLength()) + if(!usTokenUrl.isEmpty()) { OUString usBin; // "." @@ -1096,7 +1096,7 @@ void createJavaInfoFromPath(vector >& vecInfos) { usBin = usTokenUrl; } - if(usBin.getLength()) + if(!usBin.isEmpty()) { getJREInfoFromBinPath(usBin, vecInfos); } diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx index 1c3503244480..a63bfcf2dc57 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx @@ -150,7 +150,7 @@ bool VendorBase::initialize(vector > props) } else if (!bAccess && sAccessProperty.equals(i->first)) { - if (i->second.getLength() > 0) + if (!i->second.isEmpty()) { m_bAccessibility = true; bAccess = true; @@ -164,7 +164,7 @@ bool VendorBase::initialize(vector > props) return false; // init m_sRuntimeLibrary - OSL_ASSERT(m_sHome.getLength()); + OSL_ASSERT(!m_sHome.isEmpty()); //call virtual function to get the possible paths to the runtime library. int size = 0; @@ -190,7 +190,7 @@ bool VendorBase::initialize(vector > props) return false; // init m_sLD_LIBRARY_PATH - OSL_ASSERT(m_sHome.getLength()); + OSL_ASSERT(!m_sHome.isEmpty()); size = 0; char const * const * arLDPaths = getLibraryPaths( & size); vector ld_paths = getVectorFromCharArray(arLDPaths, size); @@ -263,7 +263,7 @@ bool VendorBase::supportsAccessibility() const bool VendorBase::needsRestart() const { - if (getLibraryPaths().getLength() > 0) + if (!getLibraryPaths().isEmpty()) return true; return false; } diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx index 5af3d02a49e2..e6273e0ce597 100644 --- a/jvmfwk/source/elements.cxx +++ b/jvmfwk/source/elements.cxx @@ -52,7 +52,7 @@ rtl::OString getElement(::rtl::OString const & docPath, xmlChar const * pathExpression, bool bThrowIfEmpty) { //Prepare the xml document and context - OSL_ASSERT(docPath.getLength() > 0); + OSL_ASSERT(!docPath.isEmpty()); jfw::CXmlDocPtr doc(xmlParseFile(docPath.getStr())); if (doc == NULL) throw FrameworkException( @@ -234,7 +234,7 @@ NodeJava::NodeJava(Layer layer): if (USER_OR_INSTALL == m_layer) { - if (BootParams::getInstallData().getLength() > 0) + if (!BootParams::getInstallData().isEmpty()) m_layer = INSTALL; else m_layer = USER; @@ -995,7 +995,7 @@ void CNodeJavaInfo::loadFromNode(xmlDoc * pDoc, xmlNode * pJavaInfo) cur = cur->next; } - if (sVendor.getLength() == 0) + if (sVendor.isEmpty()) m_bEmptyNode = true; //Get the javainfo attributes CXmlCharPtr sVendorUpdate; @@ -1158,7 +1158,7 @@ MergedSettings::MergedSettings(): //shared data. const ::rtl::OUString sInstall = BootParams::getInstallData(); - if (sInstall.getLength() == 0) + if (sInstall.isEmpty()) { NodeJava sharedSettings(NodeJava::SHARED); sharedSettings.load(); diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index 99f543f90b06..0fc3b5ae3697 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -510,7 +510,7 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo) JavaInfo* pJInfo = arInfos[ii]; //We remember the very first installation in aCurrentInfo - if (aCurrentInfo.getLocation().getLength() == 0) + if (aCurrentInfo.getLocation().isEmpty()) aCurrentInfo = pJInfo; // compare features // If the user does not require any features (nFeatureFlags = 0) @@ -588,7 +588,7 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo) if (aInfo) { //We remember the very first installation in aCurrentInfo - if (aCurrentInfo.getLocation().getLength() == 0) + if (aCurrentInfo.getLocation().isEmpty()) aCurrentInfo = aInfo; // compare features // If the user does not require any features (nFeatureFlags = 0) diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx index c318073aac1f..3b3bfcd8b5cd 100644 --- a/jvmfwk/source/fwkbase.cxx +++ b/jvmfwk/source/fwkbase.cxx @@ -72,7 +72,7 @@ namespace { rtl::OString getVendorSettingsPath(rtl::OUString const & sURL) { - if (sURL.getLength() == 0) + if (sURL.isEmpty()) return rtl::OString(); rtl::OUString sSystemPathSettings; if (osl_getSystemPathFromFileURL(sURL.pData, @@ -119,14 +119,14 @@ VendorSettings::VendorSettings(): "VendorSettings::VendorSettings() (fwkbase.cxx)"); //Prepare the xml document and context OString sSettingsPath = getVendorSettingsPath(m_xmlDocVendorSettingsFileUrl); - if (sSettingsPath.getLength() == 0) + if (sSettingsPath.isEmpty()) { OString sMsg("[Java framework] A vendor settings file was not specified." "Check the bootstrap parameter " UNO_JAVA_JFW_VENDOR_SETTINGS "."); OSL_FAIL(sMsg.getStr()); throw FrameworkException(JFW_E_CONFIGURATION, sMsg); } - if (sSettingsPath.getLength() > 0) + if (!sSettingsPath.isEmpty()) { m_xmlDocVendorSettings = xmlParseFile(sSettingsPath.getStr()); if (m_xmlDocVendorSettings == NULL) @@ -174,7 +174,7 @@ std::vector VendorSettings::getPluginData() //create the file URL to the library OUString sUrl = findPlugin( m_xmlDocVendorSettingsFileUrl, sTextLibrary); - if (sUrl.getLength() == 0) + if (sUrl.isEmpty()) { OString sPlugin = OUStringToOString( sTextLibrary, osl_getThreadTextEncoding()); @@ -193,7 +193,7 @@ std::vector VendorSettings::getPluginData() VersionInfo VendorSettings::getVersionInformation(const rtl::OUString & sVendor) { - OSL_ASSERT(sVendor.getLength() > 0); + OSL_ASSERT(!sVendor.isEmpty()); VersionInfo aVersionInfo; OString osVendor = OUStringToOString(sVendor, RTL_TEXTENCODING_UTF8); //Get minVersion @@ -303,7 +303,7 @@ std::vector VendorSettings::getSupportedVendors() OUString VendorSettings::getPluginLibrary(const OUString& sVendor) { - OSL_ASSERT(sVendor.getLength() > 0); + OSL_ASSERT(!sVendor.isEmpty()); OString sExcMsg("[Java framework] Error in function getPluginLibrary (fwkbase.cxx)."); OString sVendorsPath = getVendorSettingsPath(m_xmlDocVendorSettingsFileUrl); @@ -327,7 +327,7 @@ OUString VendorSettings::getPluginLibrary(const OUString& sVendor) //make an absolute file url from the relative plugin URL OUString sUrl = findPlugin(m_xmlDocVendorSettingsFileUrl, xmlCharPlugin); - if (sUrl.getLength() == 0) + if (sUrl.isEmpty()) { OString sPlugin = OUStringToOString( xmlCharPlugin, osl_getThreadTextEncoding()); @@ -616,7 +616,7 @@ rtl::OUString getApplicationClassPath() OSL_ASSERT(getMode() == JFW_MODE_APPLICATION); rtl::OUString retVal; rtl::OUString sParams = BootParams::getClasspathUrls(); - if (sParams.getLength() == 0) + if (sParams.isEmpty()) return retVal; rtl::OUStringBuffer buf; @@ -625,13 +625,13 @@ rtl::OUString getApplicationClassPath() do { ::rtl::OUString token( sParams.getToken( 0, ' ', index ).trim() ); - if (token.getLength()) + if (!token.isEmpty()) { ::rtl::OUString systemPathElement; oslFileError rc = osl_getSystemPathFromFileURL( token.pData, &systemPathElement.pData ); OSL_ASSERT( rc == osl_File_E_None ); - if (rc == osl_File_E_None && systemPathElement.getLength() > 0) + if (rc == osl_File_E_None && !systemPathElement.isEmpty()) { if (buf.getLength() > 0) buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( @@ -652,14 +652,14 @@ rtl::OString makeClassPathOption(OUString const & sUserClassPath) char szSep[] = {SAL_PATHSEPARATOR,0}; // append all user selected jars to the class path - if (sUserClassPath.getLength() > 0) + if (!sUserClassPath.isEmpty()) sBufCP.append(sUserClassPath); //append all jar libraries and components to the class path OUString sAppCP = getApplicationClassPath(); - if (sAppCP.getLength()) + if (!sAppCP.isEmpty()) { - if (sUserClassPath.getLength()) + if (!sUserClassPath.isEmpty()) sBufCP.appendAscii(szSep); sBufCP.append(sAppCP); } @@ -689,7 +689,7 @@ rtl::OString getInstallSettingsPath() rtl::OString getSettingsPath( const rtl::OUString & sURL) { - if (sURL.getLength() == 0) + if (sURL.isEmpty()) return rtl::OString(); rtl::OUString sPath; if (osl_getSystemPathFromFileURL(sURL.pData, -- cgit v1.2.3