diff options
-rw-r--r-- | cui/source/options/optjava.cxx | 9 | ||||
-rw-r--r-- | cui/source/options/optjava.hxx | 2 | ||||
-rw-r--r-- | desktop/source/migration/services/jvmfwk.cxx | 4 | ||||
-rw-r--r-- | include/jvmfwk/framework.hxx | 13 | ||||
-rw-r--r-- | jvmfwk/inc/elements.hxx | 2 | ||||
-rw-r--r-- | jvmfwk/source/elements.cxx | 8 | ||||
-rw-r--r-- | jvmfwk/source/framework.cxx | 22 |
7 files changed, 25 insertions, 35 deletions
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index a0d4d8dabcc1..84c9fef6ca1b 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -140,7 +140,6 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet& , m_pPathDlg(nullptr) #if HAVE_FEATURE_JAVA , m_parParameters(nullptr) - , m_pClassPath(nullptr) , m_nParamSize(0) #endif , m_aResetIdle("cui options SvxJavaOptionsPage Reset") @@ -347,7 +346,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl, Button*, void) { m_pPathDlg = VclPtr<SvxJavaClassPathDlg>::Create( this ); javaFrameworkError eErr = jfw_getUserClassPath( &m_pClassPath ); - if ( JFW_E_NONE == eErr && m_pClassPath ) + if ( JFW_E_NONE == eErr ) { sClassPath = m_pClassPath; m_pPathDlg->SetClassPath( sClassPath ); @@ -538,7 +537,7 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder ) #if HAVE_FEATURE_JAVA bool bStartAgain = true; std::unique_ptr<JavaInfo> pInfo; - javaFrameworkError eErr = jfw_getJavaInfoByPath( _rFolder.pData, &pInfo ); + javaFrameworkError eErr = jfw_getJavaInfoByPath( _rFolder, &pInfo ); if ( JFW_E_NONE == eErr && pInfo ) { sal_Int32 nPos = 0; @@ -568,7 +567,7 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder ) if ( !bFound ) { - jfw_addJRELocation( pInfo->sLocation.pData ); + jfw_addJRELocation( pInfo->sLocation ); AddJRE( pInfo.get() ); m_aAddedInfos.push_back( std::move(pInfo) ); nPos = m_pJavaList->GetEntryCount() - 1; @@ -650,7 +649,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ ) OUString sPath( m_pPathDlg->GetClassPath() ); if ( m_pPathDlg->GetOldPath() != sPath ) { - eErr = jfw_setUserClassPath( sPath.pData ); + eErr = jfw_setUserClassPath( sPath ); SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setUserClassPath"); bModified = true; } diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx index 6b301d2e229c..47fb0a85e32c 100644 --- a/cui/source/options/optjava.hxx +++ b/cui/source/options/optjava.hxx @@ -67,7 +67,7 @@ private: #if HAVE_FEATURE_JAVA std::vector<std::unique_ptr<JavaInfo>> m_parJavaInfo; rtl_uString** m_parParameters; - rtl_uString* m_pClassPath; + OUString m_pClassPath; sal_Int32 m_nParamSize; #endif OUString m_sInstallText; diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx index 9fb42e96c9e8..fc858ec3a039 100644 --- a/desktop/source/migration/services/jvmfwk.cxx +++ b/desktop/source/migration/services/jvmfwk.cxx @@ -239,7 +239,7 @@ void JavaMigration::migrateJavarc() { //get the directory std::unique_ptr<JavaInfo> aInfo; - javaFrameworkError err = jfw_getJavaInfoByPath(sValue.pData, &aInfo); + javaFrameworkError err = jfw_getJavaInfoByPath(sValue, &aInfo); if (err == JFW_E_NONE) { @@ -339,7 +339,7 @@ void SAL_CALL JavaMigration::setPropertyValue( "[Service implementation " IMPL_NAME "] XLayerHandler::setPropertyValue received wrong type for UserClassPath property", nullptr, Any()); - if (jfw_setUserClassPath(cp.pData) != JFW_E_NONE) + if (jfw_setUserClassPath(cp) != JFW_E_NONE) throw WrappedTargetException( "[Service implementation " IMPL_NAME "] XLayerHandler::setPropertyValue: jfw_setUserClassPath failed.", nullptr, Any()); diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx index fe806af5bc83..c0aff6841682 100644 --- a/include/jvmfwk/framework.hxx +++ b/include/jvmfwk/framework.hxx @@ -419,7 +419,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAllJREs( requirements as determined by the javavendors.xml */ JVMFWK_DLLPUBLIC javaFrameworkError jfw_getJavaInfoByPath( - rtl_uString *pPath, std::unique_ptr<JavaInfo> *ppInfo); + OUString const & pPath, std::unique_ptr<JavaInfo> *ppInfo); /** starts a Java Virtual Machine (JVM). @@ -643,16 +643,14 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_getVMParameters( were not met.<br/> JFW_E_DIRECT_MODE the function cannot be used in this mode. */ -JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath(rtl_uString * pCP); +JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath(OUString const & pCP); /** provides the value of the current user class path. <p>The function returns an empty string if no user class path is set. </p> @param ppCP - [out] contains the user class path on return. If <code>*ppCP</code> was - not NULL then the value is overwritten. No attempt at freeing that string - is made. + [out] contains the user class path on return. @return JFW_E_NONE function ran successfully.<br/> @@ -661,7 +659,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath(rtl_uString * pCP); were not met.<br/> JFW_E_DIRECT_MODE the function cannot be used in this mode. */ -JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP); +JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath(OUString * ppCP); /** saves the location of a JRE. @@ -688,7 +686,8 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP); were not met.<br/> JFW_E_DIRECT_MODE the function cannot be used in this mode. */ -JVMFWK_DLLPUBLIC javaFrameworkError jfw_addJRELocation(rtl_uString * sLocation); +JVMFWK_DLLPUBLIC javaFrameworkError jfw_addJRELocation( + OUString const & sLocation); /** checks if the installation of the jre still exists. diff --git a/jvmfwk/inc/elements.hxx b/jvmfwk/inc/elements.hxx index edf44ccc0f64..a2c17bfcaeb0 100644 --- a/jvmfwk/inc/elements.hxx +++ b/jvmfwk/inc/elements.hxx @@ -210,7 +210,7 @@ public: /** adds a location to the already existing locations. Note: call load() before, then add the location and then call write(). */ - void addJRELocation(rtl_uString * sLocation); + void addJRELocation(OUString const & sLocation); /** writes the data to user settings. */ diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx index 64258699713e..70c38e852eaf 100644 --- a/jvmfwk/source/elements.cxx +++ b/jvmfwk/source/elements.cxx @@ -645,18 +645,16 @@ void NodeJava::setVmParameters(rtl_uString * * arOptions, sal_Int32 size) } } -void NodeJava::addJRELocation(rtl_uString * sLocation) +void NodeJava::addJRELocation(OUString const & sLocation) { - assert( sLocation); if (!m_JRELocations) m_JRELocations = boost::optional<std::vector<OUString> >( std::vector<OUString> ()); //only add the path if not already present std::vector<OUString>::const_iterator it = - std::find(m_JRELocations->begin(), m_JRELocations->end(), - OUString(sLocation)); + std::find(m_JRELocations->begin(), m_JRELocations->end(), sLocation); if (it == m_JRELocations->end()) - m_JRELocations->push_back(OUString(sLocation)); + m_JRELocations->push_back(sLocation); } jfw::FileStatus NodeJava::checkSettingsFileStatus(OUString const & sURL) diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index 9c3a35c56aca..5ae4c8773f71 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -641,9 +641,8 @@ javaFrameworkError jfw_getSelectedJRE(std::unique_ptr<JavaInfo> *ppInfo) if (jfw::getMode() == jfw::JFW_MODE_DIRECT) { - OUString sJRE = jfw::BootParams::getJREHome(); - - if ((errcode = jfw_getJavaInfoByPath(sJRE.pData, ppInfo)) + if ((errcode = jfw_getJavaInfoByPath( + jfw::BootParams::getJREHome(), ppInfo)) != JFW_E_NONE) throw jfw::FrameworkException( JFW_E_CONFIGURATION, @@ -688,17 +687,14 @@ bool jfw_isVMRunning() return g_pJavaVM != nullptr; } -javaFrameworkError jfw_getJavaInfoByPath(rtl_uString *pPath, std::unique_ptr<JavaInfo> *ppInfo) +javaFrameworkError jfw_getJavaInfoByPath(OUString const & pPath, std::unique_ptr<JavaInfo> *ppInfo) { - assert(pPath != nullptr); assert(ppInfo != nullptr); javaFrameworkError errcode = JFW_E_NONE; try { osl::MutexGuard guard(jfw::FwkMutex::get()); - OUString ouPath(pPath); - jfw::VendorSettings aVendorSettings; std::vector<OUString> vecVendors = aVendorSettings.getSupportedVendors(); @@ -717,7 +713,7 @@ javaFrameworkError jfw_getJavaInfoByPath(rtl_uString *pPath, std::unique_ptr<Jav //Only if it does return a JavaInfo JavaInfo* pInfo = nullptr; javaPluginError plerr = jfw_plugin_getJavaInfoByPath( - ouPath, + pPath, vendor, versionInfo.sMinVersion, versionInfo.sMaxVersion, @@ -888,9 +884,8 @@ javaFrameworkError jfw_getVMParameters( return errcode; } -javaFrameworkError jfw_setUserClassPath(rtl_uString * pCp) +javaFrameworkError jfw_setUserClassPath(OUString const & pCp) { - assert(pCp != nullptr); javaFrameworkError errcode = JFW_E_NONE; try { @@ -910,7 +905,7 @@ javaFrameworkError jfw_setUserClassPath(rtl_uString * pCp) return errcode; } -javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP) +javaFrameworkError jfw_getUserClassPath(OUString * ppCP) { assert(ppCP != nullptr); javaFrameworkError errcode = JFW_E_NONE; @@ -920,8 +915,7 @@ javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP) if (jfw::getMode() == jfw::JFW_MODE_DIRECT) return JFW_E_DIRECT_MODE; const jfw::MergedSettings settings; - *ppCP = settings.getUserClassPath().pData; - rtl_uString_acquire(*ppCP); + *ppCP = settings.getUserClassPath(); } catch (const jfw::FrameworkException& e) { @@ -932,7 +926,7 @@ javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP) return errcode; } -javaFrameworkError jfw_addJRELocation(rtl_uString * sLocation) +javaFrameworkError jfw_addJRELocation(OUString const & sLocation) { javaFrameworkError errcode = JFW_E_NONE; try |