summaryrefslogtreecommitdiff
path: root/connectivity
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 /connectivity
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 'connectivity')
-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
17 files changed, 116 insertions, 192 deletions
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;