summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-01 12:24:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-02 07:48:21 +0000
commitc0f9bdd3e644e3ebf690aff9eb1aeec4f16dbf27 (patch)
treee5bb6d31a17587452dde579803286f68ffc73672 /scripting
parent52360bf8dd567598593cb212ac85f0c919315618 (diff)
unnecessary use of OUStringBuffer in throwing exceptions
Change-Id: Iec1473264426f19c31e72260dfce9494389e474f Reviewed-on: https://gerrit.libreoffice.org/33788 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/basprov/basprov.cxx12
-rw-r--r--scripting/source/provider/ActiveMSPList.cxx26
-rw-r--r--scripting/source/provider/MasterScriptProvider.cxx5
3 files changed, 20 insertions, 23 deletions
diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx
index 39a95bd5da4a..3a1c047a351c 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -373,14 +373,12 @@ namespace basprov
if ( !xScript.is() )
{
- OUStringBuffer aMessage;
- aMessage.append( "The following Basic script could not be found:\n" );
- aMessage.append( "library: '" ).append( aLibrary ).append( "'\n" );
- aMessage.append( "module: '" ).append( aModule ).append( "'\n" );
- aMessage.append( "method: '" ).append( aMethod ).append( "'\n" );
- aMessage.append( "location: '" ).append( aLocation ).append( "'\n" );
throw provider::ScriptFrameworkErrorException(
- aMessage.makeStringAndClear(),
+ "The following Basic script could not be found:\n"
+ "library: '" + aLibrary + "'\n"
+ "module: '" + aModule + "'\n"
+ "method: '" + aMethod + "'\n"
+ "location: '" + aLocation + "'\n",
Reference< XInterface >(),
scriptURI, "Basic",
provider::ScriptFrameworkErrorType::NO_SUCH_SCRIPT );
diff --git a/scripting/source/provider/ActiveMSPList.cxx b/scripting/source/provider/ActiveMSPList.cxx
index 5ff52ea288d4..c107d287219f 100644
--- a/scripting/source/provider/ActiveMSPList.cxx
+++ b/scripting/source/provider/ActiveMSPList.cxx
@@ -137,10 +137,10 @@ Reference< provider::XScriptProvider >
xScripts.set( xContext->getScriptContainer() );
if ( !xScripts.is() )
{
- OUStringBuffer buf;
- buf.append( "Failed to create MasterScriptProvider for ScriptInvocationContext: " );
- buf.append( "Component supporting XEmbeddScripts interface not found." );
- throw lang::IllegalArgumentException( buf.makeStringAndClear(), nullptr, 1 );
+ throw lang::IllegalArgumentException(
+ "Failed to create MasterScriptProvider for ScriptInvocationContext: "
+ "Component supporting XEmbeddScripts interface not found.",
+ nullptr, 1 );
}
::osl::MutexGuard guard( m_mutex );
@@ -175,11 +175,11 @@ Reference< provider::XScriptProvider >
Reference< document::XScriptInvocationContext > xScriptsContext( xModel, UNO_QUERY );
if ( !xScripts.is() && !xScriptsContext.is() )
{
- OUStringBuffer buf;
- buf.append( "Failed to create MasterScriptProvider for '" );
- buf.append ( context );
- buf.append( "': Either XEmbeddScripts or XScriptInvocationContext need to be supported by the document." );
- throw lang::IllegalArgumentException( buf.makeStringAndClear(), nullptr, 1 );
+ throw lang::IllegalArgumentException(
+ "Failed to create MasterScriptProvider for '"
+ + context +
+ "': Either XEmbeddScripts or XScriptInvocationContext need to be supported by the document.",
+ nullptr, 1 );
}
::osl::MutexGuard guard( m_mutex );
@@ -221,12 +221,10 @@ Reference< provider::XScriptProvider >
}
catch( const Exception& )
{
- OUStringBuffer aMessage;
- aMessage.append( "Failed to create MasterScriptProvider for context '" );
- aMessage.append ( context );
- aMessage.append( "'." );
throw lang::WrappedTargetRuntimeException(
- aMessage.makeStringAndClear(), *this, ::cppu::getCaughtException() );
+ "Failed to create MasterScriptProvider for context '"
+ + context + "'.",
+ *this, ::cppu::getCaughtException() );
}
return msp;
}
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index 941cd07dbcb9..283de45c656e 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -157,10 +157,11 @@ void SAL_CALL MasterScriptProvider::initialize( const Sequence < Any >& args )
OUStringBuffer buf;
buf.append( "MasterScriptProvider::initialize: caught " );
- buf.append ( aError.getValueTypeName() );
+ buf.append( aError.getValueTypeName() );
buf.append( ":" );
- Exception aException; aError >>= aException;
+ Exception aException;
+ aError >>= aException;
buf.append ( aException.Message );
throw lang::WrappedTargetException( buf.makeStringAndClear(), *this, aError );
}