summaryrefslogtreecommitdiff
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
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>
-rw-r--r--comphelper/qa/unit/variadictemplates.cxx11
-rw-r--r--comphelper/source/container/enumerablemap.cxx12
-rw-r--r--comphelper/source/misc/configurationhelper.cxx21
-rw-r--r--comphelper/source/misc/namedvaluecollection.cxx13
-rw-r--r--comphelper/source/property/propertycontainerhelper.cxx17
-rw-r--r--connectivity/source/drivers/postgresql/pq_array.cxx15
-rw-r--r--connectivity/source/drivers/postgresql/pq_baseresultset.cxx32
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx35
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx41
-rw-r--r--connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx10
-rw-r--r--connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx11
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx10
-rw-r--r--connectivity/source/drivers/postgresql/pq_updateableresultset.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xbase.cxx9
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumns.cxx11
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcontainer.cxx59
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexes.cxx12
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeys.cxx7
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtables.cxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_xusers.cxx19
-rw-r--r--connectivity/source/drivers/postgresql/pq_xviews.cxx11
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_misc.cxx10
-rw-r--r--extensions/source/config/ldap/ldapaccess.cxx15
-rw-r--r--framework/source/services/autorecovery.cxx7
-rw-r--r--framework/source/services/pathsettings.cxx20
-rw-r--r--framework/source/xml/acceleratorconfigurationreader.cxx6
-rw-r--r--io/source/acceptor/acc_socket.cxx27
-rw-r--r--io/source/stm/omark.cxx48
-rw-r--r--scripting/source/basprov/basprov.cxx12
-rw-r--r--scripting/source/provider/ActiveMSPList.cxx26
-rw-r--r--scripting/source/provider/MasterScriptProvider.cxx5
-rw-r--r--svtools/source/uno/wizard/unowizard.cxx7
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx14
34 files changed, 212 insertions, 367 deletions
diff --git a/comphelper/qa/unit/variadictemplates.cxx b/comphelper/qa/unit/variadictemplates.cxx
index 77114df20fe2..2a3d0fef763f 100644
--- a/comphelper/qa/unit/variadictemplates.cxx
+++ b/comphelper/qa/unit/variadictemplates.cxx
@@ -44,14 +44,11 @@ inline void extract(
xErrorContext, static_cast<sal_Int16>(nArg) );
}
if (! fromAny(seq[nArg], &v)) {
- OUStringBuffer buf;
- buf.append( "Cannot extract ANY { " );
- buf.append( seq[nArg].getValueType().getTypeName() );
- buf.append( " } to " );
- buf.append( ::cppu::UnoType<T>::get().getTypeName() );
- buf.append( static_cast<sal_Unicode>('!') );
throw ::com::sun::star::lang::IllegalArgumentException(
- buf.makeStringAndClear(), xErrorContext,
+ "Cannot extract ANY { "
+ + seq[nArg].getValueType().getTypeName()
+ + " } to " + ::cppu::UnoType<T>::get().getTypeName(),
+ xErrorContext,
static_cast<sal_Int16>(nArg) );
}
}
diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx
index 69e89760e531..b87f2c1ea6a0 100644
--- a/comphelper/source/container/enumerablemap.cxx
+++ b/comphelper/source/container/enumerablemap.cxx
@@ -445,13 +445,11 @@ namespace comphelper
if ( !bValid )
{
- OUStringBuffer aMessage;
- aMessage.append( "Incompatible value type. Found '" );
- aMessage.append( _value.getValueTypeName() );
- aMessage.append( "', where '" );
- aMessage.append( m_aData.m_aValueType.getTypeName() );
- aMessage.append( "' (or compatible type) is expected." );
- throw IllegalTypeException( aMessage.makeStringAndClear(), *const_cast< EnumerableMap* >( this ) );
+ throw IllegalTypeException(
+ "Incompatible value type. Found '" + _value.getValueTypeName()
+ + "', where '" + m_aData.m_aValueType.getTypeName()
+ + "' (or compatible type) is expected.",
+ *const_cast< EnumerableMap* >( this ) );
}
impl_checkNaN_throw( _value, m_aData.m_aValueType );
diff --git a/comphelper/source/misc/configurationhelper.cxx b/comphelper/source/misc/configurationhelper.cxx
index 3da81093224f..6da6926daeeb 100644
--- a/comphelper/source/misc/configurationhelper.cxx
+++ b/comphelper/source/misc/configurationhelper.cxx
@@ -86,13 +86,8 @@ css::uno::Any ConfigurationHelper::readRelativeKey(const css::uno::Reference< cs
xAccess->getByHierarchicalName(sRelPath) >>= xProps;
if (!xProps.is())
{
- OUStringBuffer sMsg(256);
- sMsg.append("The requested path \"");
- sMsg.append (sRelPath );
- sMsg.append("\" does not exists." );
-
throw css::container::NoSuchElementException(
- sMsg.makeStringAndClear());
+ "The requested path \"" + sRelPath + "\" does not exist.");
}
return xProps->getPropertyValue(sKey);
}
@@ -109,13 +104,8 @@ void ConfigurationHelper::writeRelativeKey(const css::uno::Reference< css::uno::
xAccess->getByHierarchicalName(sRelPath) >>= xProps;
if (!xProps.is())
{
- OUStringBuffer sMsg(256);
- sMsg.append("The requested path \"");
- sMsg.append (sRelPath );
- sMsg.append("\" does not exists." );
-
throw css::container::NoSuchElementException(
- sMsg.makeStringAndClear());
+ "The requested path \"" + sRelPath + "\" does not exist.");
}
xProps->setPropertyValue(sKey, aValue);
}
@@ -130,13 +120,8 @@ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::makeSureSetNode
xAccess->getByHierarchicalName(sRelPathToSet) >>= xSet;
if (!xSet.is())
{
- OUStringBuffer sMsg(256);
- sMsg.append("The requested path \"");
- sMsg.append (sRelPathToSet );
- sMsg.append("\" does not exists." );
-
throw css::container::NoSuchElementException(
- sMsg.makeStringAndClear());
+ "The requested path \"" + sRelPathToSet + "\" does not exist." );
}
css::uno::Reference< css::uno::XInterface > xNode;
diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx
index 53af3a791b21..ff47011808a3 100644
--- a/comphelper/source/misc/namedvaluecollection.cxx
+++ b/comphelper/source/misc/namedvaluecollection.cxx
@@ -260,14 +260,11 @@ namespace comphelper
return true;
// argument exists, but is of wrong type
- OUStringBuffer aBuffer;
- aBuffer.append( "Invalid value type for '" );
- aBuffer.append ( _rValueName );
- aBuffer.append( "'.\nExpected: " );
- aBuffer.append ( _rExpectedValueType.getTypeName() );
- aBuffer.append( "\nFound: " );
- aBuffer.append ( pos->second.getValueType().getTypeName() );
- throw IllegalArgumentException( aBuffer.makeStringAndClear(), nullptr, 0 );
+ throw IllegalArgumentException(
+ "Invalid value type for '" + _rValueName
+ + "'.\nExpected: " + _rExpectedValueType.getTypeName()
+ + "\nFound: " + pos->second.getValueType().getTypeName(),
+ nullptr, 0 );
}
// argument does not exist
diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx
index 5e7fa4f00e16..adaa6557a860 100644
--- a/comphelper/source/property/propertycontainerhelper.cxx
+++ b/comphelper/source/property/propertycontainerhelper.cxx
@@ -200,16 +200,13 @@ namespace
{
void lcl_throwIllegalPropertyValueTypeException( const PropertyDescription& _rProperty, const Any& _rValue )
{
- OUStringBuffer aErrorMessage;
- aErrorMessage.append( "The given value cannot be converted to the required property type." );
- aErrorMessage.append( "\n(property name \"" );
- aErrorMessage.append( _rProperty.aProperty.Name );
- aErrorMessage.append( "\", found value type \"" );
- aErrorMessage.append( _rValue.getValueType().getTypeName() );
- aErrorMessage.append( "\", required property type \"" );
- aErrorMessage.append( _rProperty.aProperty.Type.getTypeName() );
- aErrorMessage.append( "\")" );
- throw IllegalArgumentException( aErrorMessage.makeStringAndClear(), nullptr, 4 );
+ throw IllegalArgumentException(
+ "The given value cannot be converted to the required property type."
+ " (property name \"" + _rProperty.aProperty.Name
+ + "\", found value type \"" + _rValue.getValueType().getTypeName()
+ + "\", required property type \"" + _rProperty.aProperty.Type.getTypeName()
+ + "\")",
+ nullptr, 4 );
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_array.cxx b/connectivity/source/drivers/postgresql/pq_array.cxx
index cf4b439527f2..c00cc20d0b6e 100644
--- a/connectivity/source/drivers/postgresql/pq_array.cxx
+++ b/connectivity/source/drivers/postgresql/pq_array.cxx
@@ -110,15 +110,12 @@ void Array::checkRange( sal_Int32 index, sal_Int32 count )
{
if( index >= 1 && index -1 + count <= (sal_Int32)m_data.size() )
return;
- OUStringBuffer buf;
- buf.append( "Array::getArrayAtIndex(): allowed range for index + count " );
- buf.append( (sal_Int32)m_data.size() );
- buf.append( ", got " );
- buf.append( index );
- buf.append( " + " );
- buf.append( count );
-
- throw SQLException( buf.makeStringAndClear() , *this, OUString(), 1, Any());
+ throw SQLException(
+ "Array::getArrayAtIndex(): allowed range for index + count "
+ + OUString::number( m_data.size() )
+ + ", got " + OUString::number( index )
+ + " + " + OUString::number( count ),
+ *this, OUString(), 1, Any());
}
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
index 19e03091541c..053a3e53fcdd 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
@@ -590,11 +590,9 @@ sal_Bool BaseResultSet::convertFastPropertyValue(
}
default:
{
- OUStringBuffer buf(128);
- buf.append( "pq_resultset: Invalid property handle (" );
- buf.append( nHandle );
- buf.append( ")" );
- throw IllegalArgumentException( buf.makeStringAndClear(), *this, 2 );
+ throw IllegalArgumentException(
+ "pq_resultset: Invalid property handle (" + OUString::number( nHandle ) + ")",
+ *this, 2 );
}
}
return bRet;
@@ -626,13 +624,12 @@ void BaseResultSet::checkColumnIndex(sal_Int32 index )
{
if( index < 1 || index > m_fieldCount )
{
- OUStringBuffer buf(128);
- buf.append( "pq_resultset: index out of range (" );
- buf.append( index );
- buf.append( ", allowed range is 1 to " );
- buf.append( m_fieldCount );
- buf.append( ")" );
- throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any() );
+ throw SQLException(
+ "pq_resultset: index out of range ("
+ + OUString::number( index )
+ + ", allowed range is 1 to " + OUString::number( m_fieldCount )
+ + ")",
+ *this, OUString(), 1, Any() );
}
}
@@ -641,13 +638,10 @@ void BaseResultSet::checkRowIndex()
{
if( m_row < 0 || m_row >= m_rowCount )
{
- OUStringBuffer buf( 128 );
- buf.append( "pq_baseresultset: row index out of range, allowed is " );
- buf.append( "0 to " );
- buf.append( ((sal_Int32)(m_rowCount -1)) );
- buf.append( ", got " );
- buf.append( m_row );
- throw SQLException( buf.makeStringAndClear(), *this, OUString(),1, Any() );
+ throw SQLException(
+ "pq_baseresultset: row index out of range, allowed is 0 to " + OUString::number( m_rowCount -1 )
+ + ", got " + OUString::number( m_row ),
+ *this, OUString(),1, Any() );
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index fac27fdde9e3..d652bb7f5d23 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -489,18 +489,17 @@ void Connection::initialize( const Sequence< Any >& aArguments )
}
if( aArguments.getLength() != 2 )
{
- OUStringBuffer buf(128);
- buf.append( "pq_driver: expected 2 arguments, got " );
- buf.append( aArguments.getLength( ) );
- throw IllegalArgumentException(buf.makeStringAndClear(), Reference< XInterface > () , 0 );
+ throw IllegalArgumentException(
+ "pq_driver: expected 2 arguments, got " + OUString::number( aArguments.getLength( ) ),
+ Reference< XInterface > () , 0 );
}
if( ! (aArguments[0] >>= url) )
{
- OUStringBuffer buf(128);
- buf.append( "pq_driver: expected string as first argument, got " );
- buf.append( aArguments[0].getValueType().getTypeName() );
- throw IllegalArgumentException( buf.makeStringAndClear() , *this, 0 );
+ throw IllegalArgumentException(
+ "pq_driver: expected string as first argument, got "
+ + aArguments[0].getValueType().getTypeName(),
+ *this, 0 );
}
tc->convertTo( aArguments[1], cppu::UnoType<decltype(args)>::get() ) >>= args;
@@ -533,14 +532,11 @@ void Connection::initialize( const Sequence< Any >& aArguments )
}
else
errorMessage = "#no error message#";
- OUStringBuffer buf( 128 );
- buf.append( "Error in database URL '" );
- buf.append( url );
- buf.append( "':\n" );
- buf.append( errorMessage );
// HY092 is "Invalid attribute/option identifier."
// Just the most likely error; the error might be HY024 "Invalid attribute value".
- throw SQLException( buf.makeStringAndClear(), *this, "HY092", 5, Any() );
+ throw SQLException(
+ "Error in database URL '" + url + "':\n" + errorMessage,
+ *this, "HY092", 5, Any() );
}
for ( PQconninfoOption * opt = oOpts.get(); opt->keyword != nullptr; ++opt)
@@ -562,17 +558,14 @@ void Connection::initialize( const Sequence< Any >& aArguments )
throw RuntimeException("pq_driver: out of memory" );
if( PQstatus( m_settings.pConnection ) == CONNECTION_BAD )
{
- OUStringBuffer buf( 128 );
-
const char * error = PQerrorMessage( m_settings.pConnection );
OUString errorMessage( error, strlen( error) , RTL_TEXTENCODING_ASCII_US );
- buf.append( "Couldn't establish database connection to '" );
- buf.append( url );
- buf.append( "'\n" );
- buf.append( errorMessage );
PQfinish( m_settings.pConnection );
m_settings.pConnection = nullptr;
- throw SQLException( buf.makeStringAndClear(), *this, errorMessage, CONNECTION_BAD, Any() );
+ throw SQLException(
+ "Couldn't establish database connection to '" + url + "'\n"
+ + errorMessage,
+ *this, errorMessage, CONNECTION_BAD, Any() );
}
PQsetClientEncoding( m_settings.pConnection, "UNICODE" );
char *p = PQuser( m_settings.pConnection );
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 1ec3b8073735..16e7ddfb2d3f 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -212,15 +212,13 @@ void PreparedStatement::checkColumnIndex( sal_Int32 parameterIndex )
{
if( parameterIndex < 1 || parameterIndex > (sal_Int32) m_vars.size() )
{
- OUStringBuffer buf( 128 );
- buf.append( "pq_preparedstatement: parameter index out of range (expected 1 to " );
- buf.append( (sal_Int32 ) m_vars.size() );
- buf.append( ", got " );
- buf.append( parameterIndex );
- buf.append( ", statement '" );
- buf.append( OStringToOUString( m_stmt, ConnectionSettings::encoding ) );
- buf.append( "')" );
- throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any () );
+ throw SQLException(
+ "pq_preparedstatement: parameter index out of range (expected 1 to "
+ + OUString::number( m_vars.size() )
+ + ", got " + OUString::number( parameterIndex )
+ + ", statement '" + OStringToOUString( m_stmt, ConnectionSettings::encoding )
+ + "')",
+ *this, OUString(), 1, Any () );
}
}
void PreparedStatement::checkClosed()
@@ -580,10 +578,9 @@ void PreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x )
{
if( ! implSetObject( this, parameterIndex, x ))
{
- OUStringBuffer buf;
- buf.append( "pq_preparedstatement::setObject: can't convert value of type " );
- buf.append( x.getValueTypeName() );
- throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any () );
+ throw SQLException(
+ "pq_preparedstatement::setObject: can't convert value of type " + x.getValueTypeName(),
+ *this, OUString(), 1, Any () );
}
}
@@ -614,11 +611,10 @@ void PreparedStatement::setObjectWithInfo(
}
else
{
- OUStringBuffer buf;
- buf.append( "pq_preparedstatement::setObjectWithInfo: can't convert value of type " );
- buf.append( x.getValueTypeName() );
- buf.append( " to type DECIMAL or NUMERIC" );
- throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any () );
+ throw SQLException(
+ "pq_preparedstatement::setObjectWithInfo: can't convert value of type "
+ + x.getValueTypeName() + " to type DECIMAL or NUMERIC",
+ *this, OUString(), 1, Any () );
}
}
else
@@ -731,11 +727,10 @@ sal_Bool PreparedStatement::convertFastPropertyValue(
}
default:
{
- OUStringBuffer buf(128);
- buf.append( "pq_statement: Invalid property handle (" );
- buf.append( nHandle );
- buf.append( ")" );
- throw IllegalArgumentException( buf.makeStringAndClear(), *this, 2 );
+ throw IllegalArgumentException(
+ "pq_statement: Invalid property handle ("
+ + OUString::number( nHandle ) + ")",
+ *this, 2 );
}
}
return bRet;
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
index a121354f753f..b958ab50a2c9 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
@@ -436,14 +436,10 @@ void ResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex)
{
if( columnIndex < 1 || columnIndex > m_colCount )
{
- OUStringBuffer buf(128);
-
- buf.append( "pq_resultsetmetadata: index out of range (expected 1 to " );
- buf.append( m_colCount );
- buf.append( ", got " );
- buf.append( columnIndex );
throw SQLException(
- buf.makeStringAndClear(), *this, OUString(), 1, Any() );
+ "pq_resultsetmetadata: index out of range (expected 1 to "
+ + OUString::number( m_colCount ) + ", got " + OUString::number( columnIndex ),
+ *this, OUString(), 1, Any() );
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx
index bde1ac37ec92..2dc1dfd0f561 100644
--- a/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx
@@ -179,14 +179,11 @@ void SequenceResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex)
{
if( columnIndex < 1 || columnIndex > m_colCount )
{
- OUStringBuffer buf(128);
-
- buf.append( "pq_sequenceresultsetmetadata: index out of range (expected 1 to " );
- buf.append( m_colCount );
- buf.append( ", got " );
- buf.append( columnIndex );
throw SQLException(
- buf.makeStringAndClear(), *this, OUString(), 1, Any() );
+ "pq_sequenceresultsetmetadata: index out of range (expected 1 to "
+ + OUString::number( m_colCount )
+ + ", got " + OUString::number( columnIndex ),
+ *this, OUString(), 1, Any() );
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index 51a38056945b..31b9bf64b571 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -917,11 +917,10 @@ sal_Bool Statement::convertFastPropertyValue(
}
default:
{
- OUStringBuffer buf(128);
- buf.append( "pq_statement: Invalid property handle (" );
- buf.append( nHandle );
- buf.append( ")" );
- throw IllegalArgumentException( buf.makeStringAndClear(), *this, 2 );
+ throw IllegalArgumentException(
+ "pq_statement: Invalid property handle ("
+ + OUString::number( nHandle ) + ")",
+ *this, 2 );
}
}
return bRet;
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 48728f51ca82..a7f2e2882d6f 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -638,15 +638,9 @@ std::vector< Any > parseArray( const OUString & str )
brackets --;
if( brackets < 0 )
{
-
- OUStringBuffer buf;
- buf.append( "error during array parsing, didn't expect a } at position " );
- buf.append( (sal_Int32) i );
- buf.append( " ('" );
- buf.append( str );
- buf.append( "')" );
throw SQLException(
- buf.makeStringAndClear(),
+ "error during array parsing, didn't expect a } at position "
+ + OUString::number(i) + " ('" + str + "')",
Reference< XInterface > (), OUString(), 1, Any() );
}
if( brackets == 0 )
diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
index 3ec872e448de..304e769e510f 100644
--- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx
@@ -348,11 +348,10 @@ void UpdateableResultSet::deleteRow( )
if( m_row < 0 || m_row >= m_rowCount )
{
- OUStringBuffer buf( 128 );
- buf.append( "deleteRow cannot be called on invalid row (" );
- buf.append( m_row );
- buf.append( ")" );
- throw SQLException( buf.makeStringAndClear() , *this, OUString(), 0, Any() );
+ throw SQLException(
+ "deleteRow cannot be called on invalid row ("
+ + OUString::number(m_row) + ")",
+ *this, OUString(), 0, Any() );
}
Reference< XStatement > stmt = extractConnectionFromStatement(m_owner)->createStatement();
diff --git a/connectivity/source/drivers/postgresql/pq_xbase.cxx b/connectivity/source/drivers/postgresql/pq_xbase.cxx
index 627e60fe4ca3..8da5422c5cea 100644
--- a/connectivity/source/drivers/postgresql/pq_xbase.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xbase.cxx
@@ -99,12 +99,9 @@ void ReflectionBase::setPropertyValue_NoBroadcast_public(
sal_Int32 nHandle = m_propsDesc.getHandleByName( name );
if( -1 == nHandle )
{
- OUStringBuffer buf(128);
- buf.append( "Unknown property '" );
- buf.append( name );
- buf.append( "' in " );
- buf.append( m_implName );
- throw css::uno::RuntimeException( buf.makeStringAndClear() , *this );
+ throw css::uno::RuntimeException(
+ "Unknown property '" + name + "' in " + m_implName,
+ *this );
}
setFastPropertyValue_NoBroadcast( nHandle , value );
}
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
index da43c62d7b36..86fa618ea70c 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
@@ -498,14 +498,11 @@ void Columns::dropByIndex( sal_Int32 index )
osl::MutexGuard guard( m_refMutex->mutex );
if( index < 0 || index >= (sal_Int32)m_values.size() )
{
- OUStringBuffer buf( 128 );
- buf.append( "COLUMNS: Index out of range (allowed 0 to " );
- buf.append((sal_Int32)(m_values.size() -1) );
- buf.append( ", got " );
- buf.append( index );
- buf.append( ")" );
throw css::lang::IndexOutOfBoundsException(
- buf.makeStringAndClear(), *this );
+ "COLUMNS: Index out of range (allowed 0 to "
+ + OUString::number(m_values.size() -1)
+ + ", got " + OUString::number( index ) + ")",
+ *this );
}
Reference< XPropertySet > set;
diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
index 2710f8bf2748..6a7b9dd612e1 100644
--- a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
@@ -150,13 +150,9 @@ Any Container::getByName( const OUString& aName )
String2IntMap::const_iterator ii = m_name2index.find( aName );
if( ii == m_name2index.end() )
{
- OUStringBuffer buf(128);
- buf.append( "Element " );
- buf.append( aName );
- buf.append( " unknown in " );
- buf.append( m_type );
- buf.append( "-Container" );
- throw NoSuchElementException( buf.makeStringAndClear() , *this );
+ throw NoSuchElementException(
+ "Element " + aName + " unknown in " + m_type + "-Container",
+ *this );
}
OSL_ASSERT( ii->second >= 0 && ii->second < (int)m_values.size() );
return m_values[ ii->second ];
@@ -195,14 +191,11 @@ Any Container::getByIndex( sal_Int32 Index )
{
if( Index < 0 || Index >= (sal_Int32)m_values.size() )
{
- OUStringBuffer buf(128);
- buf.append( "Index " );
- buf.append( Index );
- buf.append(" out of range for " );
- buf.append( m_type );
- buf.append("-Container, expected 0 <= x <= " );
- buf.append( (sal_Int32 ) (m_values.size() -1));
- throw IndexOutOfBoundsException( buf.makeStringAndClear(), *this );
+ throw IndexOutOfBoundsException(
+ "Index " + OUString::number( Index )
+ + " out of range for " + m_type + "-Container, expected 0 <= x <= "
+ + OUString::number(m_values.size() -1),
+ *this );
}
return m_values[Index];
}
@@ -292,18 +285,10 @@ void Container::dropByName( const OUString& elementName )
String2IntMap::const_iterator ii = m_name2index.find( elementName );
if( ii == m_name2index.end() )
{
- OUStringBuffer buf( 128 );
- buf.append( "Column " );
- buf.append( elementName );
- buf.append( " is unknown in " );
- buf.append( m_type );
-// buf.appendAscii( " " );
-// buf.append( m_schemaName );
-// buf.appendAscii( "." );
-// buf.append( m_tableName );
- buf.append( " container, so it can't be dropped" );
throw css::container::NoSuchElementException(
- buf.makeStringAndClear(), *this );
+ "Column " + elementName + " is unknown in "
+ + m_type + " container, so it can't be dropped",
+ *this );
}
dropByIndex( ii->second );
}
@@ -313,15 +298,12 @@ void Container::dropByIndex( sal_Int32 index )
osl::MutexGuard guard( m_refMutex->mutex );
if( index < 0 || index >=(sal_Int32)m_values.size() )
{
- OUStringBuffer buf( 128 );
- buf.append( "Index out of range (allowed 0 to " );
- buf.append((sal_Int32)(m_values.size() -1) );
- buf.append( ", got " );
- buf.append( index );
- buf.append( ") in " );
- buf.append( m_type );
throw css::lang::IndexOutOfBoundsException(
- buf.makeStringAndClear(), *this );
+ "Index out of range (allowed 0 to "
+ + OUString::number(m_values.size() -1)
+ + ", got " + OUString::number( index )
+ + ") in " + m_type,
+ *this );
}
OUString name;
@@ -367,14 +349,9 @@ void Container::append(
if( hasByName( name ) )
{
- OUStringBuffer buf( 128 );
- buf.append( "a ");
- buf.append( m_type );
- buf.append( " with name " );
- buf.append( name );
- buf.append( " already exists in this container" );
throw css::container::ElementExistException(
- buf.makeStringAndClear() , *this );
+ "a " + m_type + " with name " + name + " already exists in this container",
+ *this );
}
int index = m_values.size();
diff --git a/connectivity/source/drivers/postgresql/pq_xindexes.cxx b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
index 19001cf040ea..031584ffe273 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexes.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
@@ -243,14 +243,12 @@ void Indexes::dropByIndex( sal_Int32 index )
osl::MutexGuard guard( m_refMutex->mutex );
if( index < 0 || index >= (sal_Int32)m_values.size() )
{
- OUStringBuffer buf( 128 );
- buf.append( "Indexes: Index out of range (allowed 0 to " );
- buf.append( (sal_Int32) (m_values.size() -1) );
- buf.append( ", got " );
- buf.append( index );
- buf.append( ")" );
throw css::lang::IndexOutOfBoundsException(
- buf.makeStringAndClear(), *this );
+ "Indexes: Index out of range (allowed 0 to "
+ + OUString::number( m_values.size() -1 )
+ + ", got " + OUString::number( index )
+ + ")",
+ *this );
}
Reference< XPropertySet > set;
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
index 4fd0f3390544..4e8f772c3569 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
@@ -226,11 +226,10 @@ void Keys::dropByIndex( sal_Int32 index )
osl::MutexGuard guard( m_refMutex->mutex );
if( index < 0 || index >= (sal_Int32)m_values.size() )
{
- OUStringBuffer buf( 128 );
- buf.append( "TABLES: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1) +
- ", got " + OUString::number( index ) + ")" );
throw css::lang::IndexOutOfBoundsException(
- buf.makeStringAndClear(), *this );
+ "TABLES: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1)
+ + ", got " + OUString::number( index ) + ")",
+ *this );
}
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.cxx b/connectivity/source/drivers/postgresql/pq_xtables.cxx
index b5d39baa276d..dbb045498275 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.cxx
@@ -313,10 +313,10 @@ void Tables::dropByIndex( sal_Int32 index )
osl::MutexGuard guard( m_refMutex->mutex );
if( index < 0 || index >= (sal_Int32)m_values.size() )
{
- OUStringBuffer buf( 128 );
- buf.append( "TABLES: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1) +
- ", got " + OUString::number( index ) + ")" );
- throw css::lang::IndexOutOfBoundsException( buf.makeStringAndClear(), *this );
+ throw css::lang::IndexOutOfBoundsException(
+ "TABLES: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1)
+ + ", got " + OUString::number( index ) + ")",
+ *this );
}
Reference< XPropertySet > set;
diff --git a/connectivity/source/drivers/postgresql/pq_xusers.cxx b/connectivity/source/drivers/postgresql/pq_xusers.cxx
index aae6c1b551f7..ff87f1bc4c80 100644
--- a/connectivity/source/drivers/postgresql/pq_xusers.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xusers.cxx
@@ -136,12 +136,9 @@ void Users::dropByName( const OUString& elementName )
String2IntMap::const_iterator ii = m_name2index.find( elementName );
if( ii == m_name2index.end() )
{
- OUStringBuffer buf( 128 );
- buf.append( "User " );
- buf.append( elementName );
- buf.append( " is unknown, so it can't be dropped" );
throw css::container::NoSuchElementException(
- buf.makeStringAndClear(), *this );
+ "User " + elementName + " is unknown, so it can't be dropped",
+ *this );
}
dropByIndex( ii->second );
}
@@ -152,14 +149,12 @@ void Users::dropByIndex( sal_Int32 index )
osl::MutexGuard guard( m_refMutex->mutex );
if( index < 0 || index >= (sal_Int32)m_values.size() )
{
- OUStringBuffer buf( 128 );
- buf.append( "USERS: Index out of range (allowed 0 to " );
- buf.append( (sal_Int32) (m_values.size() -1) );
- buf.append( ", got " );
- buf.append( index );
- buf.append( ")" );
throw css::lang::IndexOutOfBoundsException(
- buf.makeStringAndClear(), *this );
+ "USERS: Index out of range (allowed 0 to "
+ + OUString::number( m_values.size() -1 )
+ + ", got " + OUString::number( index )
+ + ")",
+ *this );
}
Reference< XPropertySet > set;
diff --git a/connectivity/source/drivers/postgresql/pq_xviews.cxx b/connectivity/source/drivers/postgresql/pq_xviews.cxx
index 311fb888494a..31b4c355bdbd 100644
--- a/connectivity/source/drivers/postgresql/pq_xviews.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xviews.cxx
@@ -163,10 +163,8 @@ void Views::dropByName( const OUString& elementName )
String2IntMap::const_iterator ii = m_name2index.find( elementName );
if( ii == m_name2index.end() )
{
- OUStringBuffer buf( 128 );
- buf.append( "View " + elementName + " is unknown, so it can't be dropped" );
throw css::container::NoSuchElementException(
- buf.makeStringAndClear(), *this );
+ "View " + elementName + " is unknown, so it can't be dropped", *this );
}
dropByIndex( ii->second );
}
@@ -176,11 +174,10 @@ void Views::dropByIndex( sal_Int32 index )
osl::MutexGuard guard( m_refMutex->mutex );
if( index < 0 || index >= (sal_Int32)m_values.size() )
{
- OUStringBuffer buf( 128 );
- buf.append( "VIEWS: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1) +
- ", got " + OUString::number( index ) + ")");
throw css::lang::IndexOutOfBoundsException(
- buf.makeStringAndClear(), *this );
+ "VIEWS: Index out of range (allowed 0 to " + OUString::number(m_values.size() -1)
+ + ", got " + OUString::number( index ) + ")",
+ *this );
}
Reference< XPropertySet > set;
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index eaab73088c24..031c6dda6e09 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -211,13 +211,9 @@ OUString makeAbsoluteFileUrl(
if (osl_getAbsoluteFileURL(
base_url.pData, file_url.pData, &abs.pData ) != osl_File_E_None)
{
- OUStringBuffer buf;
- buf.append( "making absolute file url failed: \"" );
- buf.append( base_url );
- buf.append( "\" (base-url) and \"" );
- buf.append( file_url );
- buf.append( "\" (file-url)!" );
- throw RuntimeException( buf.makeStringAndClear() );
+ throw RuntimeException(
+ "making absolute file url failed: \"" + base_url
+ + "\" (base-url) and \"" + file_url + "\" (file-url)!" );
}
return abs[ abs.getLength() -1 ] == '/'
? abs.copy( 0, abs.getLength() -1 ) : abs;
diff --git a/extensions/source/config/ldap/ldapaccess.cxx b/extensions/source/config/ldap/ldapaccess.cxx
index a1a0fde40b64..87d686e39082 100644
--- a/extensions/source/config/ldap/ldapaccess.cxx
+++ b/extensions/source/config/ldap/ldapaccess.cxx
@@ -148,10 +148,7 @@ void LdapConnection::initConnection()
{
if (mLdapDefinition.mServer.isEmpty())
{
- OUStringBuffer message ;
-
- message.append("Cannot initialise connection to LDAP: No server specified.") ;
- throw ldap::LdapConnectionException(message.makeStringAndClear()) ;
+ throw ldap::LdapConnectionException("Cannot initialise connection to LDAP: No server specified.");
}
if (mLdapDefinition.mPort == 0) mLdapDefinition.mPort = LDAP_PORT;
@@ -165,13 +162,9 @@ void LdapConnection::initConnection()
#endif
if (mConnection == nullptr)
{
- OUStringBuffer message ;
-
- message.append("Cannot initialise connection to LDAP server ") ;
- message.append(mLdapDefinition.mServer) ;
- message.append(":") ;
- message.append(mLdapDefinition.mPort) ;
- throw ldap::LdapConnectionException(message.makeStringAndClear());
+ throw ldap::LdapConnectionException(
+ "Cannot initialise connection to LDAP server "
+ + mLdapDefinition.mServer + ":" + OUString::number(mLdapDefinition.mPort));
}
}
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 4739bdc28cd7..fb9f34679d36 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3477,13 +3477,8 @@ void AutoRecovery::implts_openOneDoc(const OUString& sURL ,
}
// re-throw
- OUStringBuffer sMsg(256);
- sMsg.append("Recovery of \"");
- sMsg.append (sURL );
- sMsg.append("\" failed." );
-
throw css::lang::WrappedTargetException(
- sMsg.makeStringAndClear(),
+ "Recovery of \"" + sURL + "\" failed.",
static_cast< css::frame::XDispatch* >(this),
aCaughtException
);
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
index bd4488e664af..0c632ef8194f 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -1225,12 +1225,10 @@ void PathSettings::impl_setPathValue( sal_Int32 nID ,
{
if (aChangePath.bIsSinglePath)
{
- OUStringBuffer sMsg(256);
- sMsg.append("The path '" );
- sMsg.append (aChangePath.sPathName);
- sMsg.append("' is defined as SINGLE_PATH. It's sub set of internal paths can't be set.");
- throw css::uno::Exception(sMsg.makeStringAndClear(),
- static_cast< ::cppu::OWeakObject* >(this));
+ throw css::uno::Exception(
+ "The path '" + aChangePath.sPathName
+ + "' is defined as SINGLE_PATH. It's sub set of internal paths can't be set.",
+ static_cast< ::cppu::OWeakObject* >(this));
}
css::uno::Sequence<OUString> lTmpList;
@@ -1246,12 +1244,10 @@ void PathSettings::impl_setPathValue( sal_Int32 nID ,
{
if (aChangePath.bIsSinglePath)
{
- OUStringBuffer sMsg(256);
- sMsg.append("The path '" );
- sMsg.append (aChangePath.sPathName);
- sMsg.append("' is defined as SINGLE_PATH. It's sub set of internal paths can't be set.");
- throw css::uno::Exception(sMsg.makeStringAndClear(),
- static_cast< ::cppu::OWeakObject* >(this));
+ throw css::uno::Exception(
+ "The path '" + aChangePath.sPathName
+ + "' is defined as SINGLE_PATH. It's sub set of internal paths can't be set.",
+ static_cast< ::cppu::OWeakObject* >(this));
}
css::uno::Sequence<OUString> lTmpList;
diff --git a/framework/source/xml/acceleratorconfigurationreader.cxx b/framework/source/xml/acceleratorconfigurationreader.cxx
index b73f1f71f02e..ac0afbc4980f 100644
--- a/framework/source/xml/acceleratorconfigurationreader.cxx
+++ b/framework/source/xml/acceleratorconfigurationreader.cxx
@@ -47,12 +47,8 @@ namespace framework{
*/
#define THROW_PARSEEXCEPTION(COMMENT) \
{ \
- OUStringBuffer sMessage(256); \
- sMessage.append (implts_getErrorLineString()); \
- sMessage.append(COMMENT ); \
- \
throw css::xml::sax::SAXException( \
- sMessage.makeStringAndClear(), \
+ implts_getErrorLineString() + COMMENT, \
static_cast< css::xml::sax::XDocumentHandler* >(this), \
css::uno::Any()); \
}
diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx
index 6d6a7b17bf5e..e1cf5a3f3664 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -307,34 +307,29 @@ namespace io_acceptor {
{
if( ! m_addr.setPort( m_nPort ) )
{
- OUStringBuffer message( 128 );
- message.append( "acc_socket.cxx:SocketAcceptor::init - error - invalid tcp/ip port " );
- message.append( (sal_Int32) m_nPort );
- throw ConnectionSetupException( message.makeStringAndClear() );
+ throw ConnectionSetupException(
+ "acc_socket.cxx:SocketAcceptor::init - error - invalid tcp/ip port " +
+ OUString::number( m_nPort ));
}
if( ! m_addr.setHostname( m_sSocketName.pData ) )
{
- OUStringBuffer message( 128 );
- message.append( "acc_socket.cxx:SocketAcceptor::init - error - invalid host " );
- message.append( m_sSocketName );
- throw ConnectionSetupException( message.makeStringAndClear() );
+ throw ConnectionSetupException(
+ "acc_socket.cxx:SocketAcceptor::init - error - invalid host " + m_sSocketName );
}
m_socket.setOption( osl_Socket_OptionReuseAddr, 1);
if(! m_socket.bind(m_addr) )
{
- OUStringBuffer message( 128 );
- message.append( "acc_socket.cxx:SocketAcceptor::init - error - couldn't bind on " );
- message.append( m_sSocketName ).append( ":" ).append((sal_Int32)m_nPort);
- throw ConnectionSetupException( message.makeStringAndClear() );
+ throw ConnectionSetupException(
+ "acc_socket.cxx:SocketAcceptor::init - error - couldn't bind on " +
+ m_sSocketName + ":" + OUString::number(m_nPort));
}
if(! m_socket.listen() )
{
- OUStringBuffer message( 128 );
- message.append( "acc_socket.cxx:SocketAcceptor::init - error - can't listen on " );
- message.append( m_sSocketName ).append( ":" ).append( (sal_Int32) m_nPort);
- throw ConnectionSetupException( message.makeStringAndClear() );
+ throw ConnectionSetupException(
+ "acc_socket.cxx:SocketAcceptor::init - error - can't listen on " +
+ m_sSocketName + ":" + OUString::number(m_nPort) );
}
}
diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx
index dc9fbb8b260a..551012f9b483 100644
--- a/io/source/stm/omark.cxx
+++ b/io/source/stm/omark.cxx
@@ -212,11 +212,9 @@ void OMarkableOutputStream::deleteMark(sal_Int32 Mark)
map<sal_Int32,sal_Int32,less<sal_Int32> >::iterator ii = m_mapMarks.find( Mark );
if( ii == m_mapMarks.end() ) {
- OUStringBuffer buf( 128 );
- buf.append( "MarkableOutputStream::deleteMark unknown mark (" );
- buf.append( Mark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this, 0);
+ throw IllegalArgumentException(
+ "MarkableOutputStream::deleteMark unknown mark (" + OUString::number(Mark) + ")",
+ *this, 0);
}
else {
m_mapMarks.erase( ii );
@@ -230,11 +228,9 @@ void OMarkableOutputStream::jumpToMark(sal_Int32 nMark)
map<sal_Int32,sal_Int32,less<sal_Int32> >::iterator ii = m_mapMarks.find( nMark );
if( ii == m_mapMarks.end() ) {
- OUStringBuffer buf( 128 );
- buf.append( "MarkableOutputStream::jumpToMark unknown mark (" );
- buf.append( nMark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this, 0);
+ throw IllegalArgumentException(
+ "MarkableOutputStream::jumpToMark unknown mark (" + OUString::number(nMark) + ")",
+ *this, 0);
}
else {
m_nCurrentPos = (*ii).second;
@@ -256,11 +252,9 @@ sal_Int32 OMarkableOutputStream::offsetToMark(sal_Int32 nMark)
if( ii == m_mapMarks.end() )
{
- OUStringBuffer buf( 128 );
- buf.append( "MarkableOutputStream::offsetToMark unknown mark (" );
- buf.append( nMark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this, 0);
+ throw IllegalArgumentException(
+ "MarkableOutputStream::offsetToMark unknown mark (" + OUString::number(nMark) + ")",
+ *this, 0);
}
return m_nCurrentPos - (*ii).second;
}
@@ -650,11 +644,9 @@ void OMarkableInputStream::deleteMark(sal_Int32 Mark)
map<sal_Int32,sal_Int32,less<sal_Int32> >::iterator ii = m_mapMarks.find( Mark );
if( ii == m_mapMarks.end() ) {
- OUStringBuffer buf( 128 );
- buf.append( "MarkableInputStream::deleteMark unknown mark (" );
- buf.append( Mark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this , 0 );
+ throw IllegalArgumentException(
+ "MarkableInputStream::deleteMark unknown mark (" + OUString::number(Mark) + ")",
+ *this , 0 );
}
else {
m_mapMarks.erase( ii );
@@ -669,11 +661,9 @@ void OMarkableInputStream::jumpToMark(sal_Int32 nMark)
if( ii == m_mapMarks.end() )
{
- OUStringBuffer buf( 128 );
- buf.append( "MarkableInputStream::jumpToMark unknown mark (" );
- buf.append( nMark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this , 0 );
+ throw IllegalArgumentException(
+ "MarkableInputStream::jumpToMark unknown mark (" + OUString::number(nMark) + ")",
+ *this , 0 );
}
else
{
@@ -695,11 +685,9 @@ sal_Int32 OMarkableInputStream::offsetToMark(sal_Int32 nMark)
if( ii == m_mapMarks.end() )
{
- OUStringBuffer buf( 128 );
- buf.append( "MarkableInputStream::offsetToMark unknown mark (" );
- buf.append( nMark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this , 0 );
+ throw IllegalArgumentException(
+ "MarkableInputStream::offsetToMark unknown mark (" + OUString::number(nMark) + ")",
+ *this, 0 );
}
return m_nCurrentPos - (*ii).second;
}
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 );
}
diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx
index d4977cfe456d..d585739f1573 100644
--- a/svtools/source/uno/wizard/unowizard.cxx
+++ b/svtools/source/uno/wizard/unowizard.cxx
@@ -195,12 +195,9 @@ namespace {
{
if ( i_rPaths[i][j] <= nPreviousPageID )
{
- OStringBuffer message;
- message.append( "Path " );
- message.append( i );
- message.append( ": invalid page ID sequence - each page ID must be greater than the previous one." );
throw IllegalArgumentException(
- OStringToOUString( message.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ),
+ "Path " + OUString::number(i)
+ + ": invalid page ID sequence - each page ID must be greater than the previous one.",
i_rContext, 2 );
}
nPreviousPageID = i_rPaths[i][j];
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index d7e0ab636a46..3a2cf610f651 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -1143,17 +1143,11 @@ sal_Bool UnoControlModel::convertFastPropertyValue( Any & rConvertedValue, Any &
if (!bConverted)
{
- OUStringBuffer aErrorMessage;
- aErrorMessage.append( "Unable to convert the given value for the property " );
- aErrorMessage.append ( GetPropertyName( (sal_uInt16)nPropId ) );
- aErrorMessage.append( ".\n" );
- aErrorMessage.append( "Expected type: " );
- aErrorMessage.append ( pDestType->getTypeName() );
- aErrorMessage.append( "\n" );
- aErrorMessage.append( "Found type: " );
- aErrorMessage.append ( rValue.getValueType().getTypeName() );
throw css::lang::IllegalArgumentException(
- aErrorMessage.makeStringAndClear(),
+ "Unable to convert the given value for the property "
+ + GetPropertyName( (sal_uInt16)nPropId )
+ + ".\nExpected type: " + pDestType->getTypeName()
+ + "\nFound type: " + rValue.getValueType().getTypeName(),
static_cast< css::beans::XPropertySet* >(this),
1);
}