summaryrefslogtreecommitdiff
path: root/jvmfwk/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-29 09:48:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-05-30 08:56:39 +0200
commit4d162d8222004029561185e07230b98317ec08ff (patch)
treebad100f570f719497107f355e402a997b4981f84 /jvmfwk/source
parente3c2c245f83cfe9359d67122af307abb9db25b13 (diff)
cleanup some OString stuff in jvmfwk
Change-Id: I80d221a348c4bd5fcec82cafc455a051237ae95d Reviewed-on: https://gerrit.libreoffice.org/38131 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'jvmfwk/source')
-rw-r--r--jvmfwk/source/elements.cxx9
-rw-r--r--jvmfwk/source/framework.cxx48
-rw-r--r--jvmfwk/source/fwkbase.cxx47
-rw-r--r--jvmfwk/source/fwkutil.cxx5
4 files changed, 45 insertions, 64 deletions
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 353eab37ba6f..1807f636166b 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -56,16 +56,14 @@ OString getElement(OString const & docPath,
if (doc == nullptr)
throw FrameworkException(
JFW_E_ERROR,
- OString("[Java framework] Error in function getElement "
- "(elements.cxx)"));
+ "[Java framework] Error in function getElement (elements.cxx)");
jfw::CXPathContextPtr context(xmlXPathNewContext(doc));
if (xmlXPathRegisterNs(context, reinterpret_cast<xmlChar const *>("jf"),
reinterpret_cast<xmlChar const *>(NS_JAVA_FRAMEWORK)) == -1)
throw FrameworkException(
JFW_E_ERROR,
- OString("[Java framework] Error in function getElement "
- "(elements.cxx)"));
+ "[Java framework] Error in function getElement (elements.cxx)");
CXPathObjectPtr pathObj;
pathObj = xmlXPathEvalExpression(pathExpression, context);
@@ -75,8 +73,7 @@ OString getElement(OString const & docPath,
if (bThrowIfEmpty)
throw FrameworkException(
JFW_E_ERROR,
- OString("[Java framework] Error in function getElement "
- "(elements.cxx)"));
+ "[Java framework] Error in function getElement (elements.cxx)");
}
else
{
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index ddc5e6c19747..5b1911fb0583 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -140,8 +140,7 @@ javaFrameworkError jfw_findAllJREs(std::vector<std::unique_ptr<JavaInfo>> *pparI
}
catch (const jfw::FrameworkException& e)
{
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message);
return e.errorCode;
}
}
@@ -304,8 +303,7 @@ javaFrameworkError jfw_startVM(
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message);
}
return errcode;
@@ -540,8 +538,7 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
@@ -580,11 +577,10 @@ javaFrameworkError jfw_getSelectedJRE(std::unique_ptr<JavaInfo> *ppInfo)
!= JFW_E_NONE)
throw jfw::FrameworkException(
JFW_E_CONFIGURATION,
- OString(
- "[Java framework] The JRE specified by the bootstrap "
- "variable UNO_JAVA_JFW_JREHOME or UNO_JAVA_JFW_ENV_JREHOME "
- " could not be recognized. Check the values and make sure that you "
- "use a plug-in library that can recognize that JRE."));
+ "[Java framework] The JRE specified by the bootstrap "
+ "variable UNO_JAVA_JFW_JREHOME or UNO_JAVA_JFW_ENV_JREHOME "
+ " could not be recognized. Check the values and make sure that you "
+ "use a plug-in library that can recognize that JRE.");
return JFW_E_NONE;
}
@@ -609,8 +605,7 @@ javaFrameworkError jfw_getSelectedJRE(std::unique_ptr<JavaInfo> *ppInfo)
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
}
@@ -675,8 +670,7 @@ javaFrameworkError jfw_getJavaInfoByPath(OUString const & pPath, std::unique_ptr
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
@@ -709,8 +703,7 @@ javaFrameworkError jfw_setSelectedJRE(JavaInfo const *pInfo)
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
}
@@ -742,8 +735,7 @@ javaFrameworkError jfw_setEnabled(bool bEnabled)
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
}
@@ -763,8 +755,7 @@ javaFrameworkError jfw_getEnabled(bool *pbEnabled)
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
}
@@ -785,8 +776,7 @@ javaFrameworkError jfw_setVMParameters(std::vector<OUString> const & arOptions)
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
@@ -807,8 +797,7 @@ javaFrameworkError jfw_getVMParameters(std::vector<OUString> * parOptions)
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
}
@@ -828,8 +817,7 @@ javaFrameworkError jfw_setUserClassPath(OUString const & pCp)
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
}
@@ -849,8 +837,7 @@ javaFrameworkError jfw_getUserClassPath(OUString * ppCP)
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
}
@@ -871,8 +858,7 @@ javaFrameworkError jfw_addJRELocation(OUString const & sLocation)
catch (const jfw::FrameworkException& e)
{
errcode = e.errorCode;
- fprintf(stderr, "%s\n", e.message.getStr());
- OSL_FAIL(e.message.getStr());
+ SAL_WARN( "jfw", e.message );
}
return errcode;
diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx
index dbab7d4a9e7a..6830b9f00a55 100644
--- a/jvmfwk/source/fwkbase.cxx
+++ b/jvmfwk/source/fwkbase.cxx
@@ -56,8 +56,7 @@ OString getVendorSettingsPath(OUString const & sURL)
& sSystemPathSettings.pData) != osl_File_E_None)
throw FrameworkException(
JFW_E_ERROR,
- OString("[Java framework] Error in function "
- "getVendorSettingsPath (fwkbase.cxx) "));
+ "[Java framework] Error in function getVendorSettingsPath (fwkbase.cxx) ");
OString osSystemPathSettings =
OUStringToOString(sSystemPathSettings,osl_getThreadTextEncoding());
return osSystemPathSettings;
@@ -97,7 +96,7 @@ VendorSettings::VendorSettings():
{
OString sMsg("[Java framework] A vendor settings file was not specified."
"Check the bootstrap parameter " UNO_JAVA_JFW_VENDOR_SETTINGS ".");
- OSL_FAIL(sMsg.getStr());
+ SAL_WARN( "jfw", sMsg );
throw FrameworkException(JFW_E_CONFIGURATION, sMsg);
}
if (!sSettingsPath.isEmpty())
@@ -107,7 +106,7 @@ VendorSettings::VendorSettings():
throw FrameworkException(
JFW_E_ERROR,
OString("[Java framework] Error while parsing file: ")
- + sSettingsPath + OString("."));
+ + sSettingsPath + ".");
m_xmlPathContextVendorSettings = xmlXPathNewContext(m_xmlDocVendorSettings);
int res = xmlXPathRegisterNs(
@@ -306,16 +305,16 @@ OUString BootParams::getVendorSettings()
!= File::E_None)
throw FrameworkException(
JFW_E_CONFIGURATION,
- OString("[Java framework] Invalid value for bootstrap variable: "
- UNO_JAVA_JFW_VENDOR_SETTINGS));
+ "[Java framework] Invalid value for bootstrap variable: "
+ UNO_JAVA_JFW_VENDOR_SETTINGS);
sVendor = sAbsoluteUrl;
s = checkFileURL(sVendor);
if (s == jfw::FILE_INVALID || s == jfw::FILE_DOES_NOT_EXIST)
{
throw FrameworkException(
JFW_E_CONFIGURATION,
- OString("[Java framework] Invalid value for bootstrap variable: "
- UNO_JAVA_JFW_VENDOR_SETTINGS));
+ "[Java framework] Invalid value for bootstrap variable: "
+ UNO_JAVA_JFW_VENDOR_SETTINGS);
}
}
SAL_INFO(
@@ -337,11 +336,11 @@ OUString BootParams::getJREHome()
{
throw FrameworkException(
JFW_E_CONFIGURATION,
- OString("[Java framework] Both bootstrap parameter "
- UNO_JAVA_JFW_JREHOME" and "
- UNO_JAVA_JFW_ENV_JREHOME" are set. However only one of them can be set."
- "Check bootstrap parameters: environment variables, command line "
- "arguments, rc/ini files for executable and java framework library."));
+ "[Java framework] Both bootstrap parameter "
+ UNO_JAVA_JFW_JREHOME" and "
+ UNO_JAVA_JFW_ENV_JREHOME" are set. However only one of them can be set."
+ "Check bootstrap parameters: environment variables, command line "
+ "arguments, rc/ini files for executable and java framework library.");
}
else if (bEnvJRE)
{
@@ -349,18 +348,18 @@ OUString BootParams::getJREHome()
if (pJRE == nullptr)
{
throw FrameworkException(
- JFW_E_CONFIGURATION,
- OString("[Java framework] Both bootstrap parameter "
- UNO_JAVA_JFW_ENV_JREHOME" is set, but the environment variable "
- "JAVA_HOME is not set."));
+ JFW_E_CONFIGURATION,
+ "[Java framework] Both bootstrap parameter "
+ UNO_JAVA_JFW_ENV_JREHOME" is set, but the environment variable "
+ "JAVA_HOME is not set.");
}
OString osJRE(pJRE);
OUString usJRE = OStringToOUString(osJRE, osl_getThreadTextEncoding());
if (File::getFileURLFromSystemPath(usJRE, sJRE) != File::E_None)
throw FrameworkException(
JFW_E_ERROR,
- OString("[Java framework] Error in function BootParams::getJREHome() "
- "(fwkbase.cxx)."));
+ "[Java framework] Error in function BootParams::getJREHome() "
+ "(fwkbase.cxx).");
SAL_INFO(
"jfw.level2",
"Using bootstrap parameter " UNO_JAVA_JFW_ENV_JREHOME
@@ -372,9 +371,9 @@ OUString BootParams::getJREHome()
{
throw FrameworkException(
JFW_E_CONFIGURATION,
- OString("[Java framework] The bootstrap parameter "
- UNO_JAVA_JFW_ENV_JREHOME" or " UNO_JAVA_JFW_JREHOME
- " must be set in direct mode."));
+ "[Java framework] The bootstrap parameter "
+ UNO_JAVA_JFW_ENV_JREHOME" or " UNO_JAVA_JFW_JREHOME
+ " must be set in direct mode.");
}
SAL_INFO_IF(
@@ -514,8 +513,8 @@ OString getSettingsPath( const OUString & sURL)
if (osl_getSystemPathFromFileURL(sURL.pData,
& sPath.pData) != osl_File_E_None)
throw FrameworkException(
- JFW_E_ERROR, OString(
- "[Java framework] Error in function ::getSettingsPath (fwkbase.cxx)."));
+ JFW_E_ERROR,
+ "[Java framework] Error in function ::getSettingsPath (fwkbase.cxx).");
return OUStringToOString(sPath,osl_getThreadTextEncoding());
}
diff --git a/jvmfwk/source/fwkutil.cxx b/jvmfwk/source/fwkutil.cxx
index a77727865d17..dac76e58ea9e 100644
--- a/jvmfwk/source/fwkutil.cxx
+++ b/jvmfwk/source/fwkutil.cxx
@@ -182,14 +182,13 @@ OUString getDirFromFile(const OUString& usFilePath)
OUString getLibraryLocation()
{
- OString sExcMsg("[Java framework] Error in function getLibraryLocation "
- "(fwkutil.cxx).");
OUString libraryFileUrl;
if (!osl::Module::getUrlFromAddress(
reinterpret_cast< oslGenericFunction >(getLibraryLocation),
libraryFileUrl))
- throw FrameworkException(JFW_E_ERROR, sExcMsg);
+ throw FrameworkException(JFW_E_ERROR,
+ "[Java framework] Error in function getLibraryLocation (fwkutil.cxx).");
return getDirFromFile(libraryFileUrl);
}