diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-04-13 09:47:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-04-13 09:47:24 +0100 |
commit | 9d71fa66665fd841b1be18901c49359a454b0448 (patch) | |
tree | 0d7c5b3bdfe3c77ffa8a9043c38e2a1de9323af8 | |
parent | 2d954b614956c70d02761060dbb465d809c74fc0 (diff) |
catch by const reference
-rw-r--r-- | connectivity/source/commontools/TConnection.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/commontools/TIndexes.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 20 | ||||
-rw-r--r-- | connectivity/source/drivers/evoab2/NDriver.cxx | 13 | ||||
-rw-r--r-- | connectivity/source/drivers/evoab2/NServices.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HStorageAccess.cxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HStorageMap.cxx | 18 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/StorageFileAccess.cxx | 22 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx | 14 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/ResultSet.cxx | 8 | ||||
-rw-r--r-- | connectivity/source/drivers/odbcbase/OResultSet.cxx | 16 | ||||
-rw-r--r-- | connectivity/source/drivers/odbcbase/OStatement.cxx | 16 |
12 files changed, 74 insertions, 73 deletions
diff --git a/connectivity/source/commontools/TConnection.cxx b/connectivity/source/commontools/TConnection.cxx index a0808ae5e852..e9534ed85506 100644 --- a/connectivity/source/commontools/TConnection.cxx +++ b/connectivity/source/commontools/TConnection.cxx @@ -59,7 +59,7 @@ void OMetaConnection::disposing() Reference< XInterface > xStatement( i->get() ); ::comphelper::disposeComponent( xStatement ); } - catch (DisposedException) + catch (const DisposedException&) { } } diff --git a/connectivity/source/commontools/TIndexes.cxx b/connectivity/source/commontools/TIndexes.cxx index 796310d36039..5132a9fae89e 100644 --- a/connectivity/source/commontools/TIndexes.cxx +++ b/connectivity/source/commontools/TIndexes.cxx @@ -107,7 +107,7 @@ sdbcx::ObjectType OIndexesHelper::createObject(const ::rtl::OUString& _rName) bPrimarKeyIndex = xRow->getString(6) == aName; } } - catch(Exception) + catch(const Exception&) { } OIndexHelper* pRet = new OIndexHelper(m_pTable,aName,aQualifier,bUnique, diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 5630800b47f2..0c3462eb1206 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -643,7 +643,7 @@ String ODbaseTable::getEntry(OConnection* _pConnection,const ::rtl::OUString& _s } xDir->beforeFirst(); // move back to before first record } - catch(Exception&) + catch(const Exception&) { OSL_ASSERT(0); } @@ -700,7 +700,7 @@ void ODbaseTable::refreshIndexes() aVector.push_back(aURL.getBase()); } } - catch(Exception&) // an exception is thrown when no file exists + catch(const Exception&) // an exception is thrown when no file exists { } } @@ -1064,7 +1064,7 @@ sal_Bool ODbaseTable::CreateImpl() delete pFileStream; } } - catch(Exception&) // an exception is thrown when no file exists + catch(const Exception&) // an exception is thrown when no file exists { } @@ -1081,7 +1081,7 @@ sal_Bool ODbaseTable::CreateImpl() Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>()); aContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),bool2any( sal_True ) ); } - catch(Exception&) // an exception is thrown when no file exists + catch(const Exception&) // an exception is thrown when no file exists { } return sal_False; @@ -1098,7 +1098,7 @@ sal_Bool ODbaseTable::CreateImpl() { bMemoAlreadyExists = aMemo1Content.isDocument(); } - catch(Exception&) // an exception is thrown when no file exists + catch(const Exception&) // an exception is thrown when no file exists { } if (bMemoAlreadyExists) @@ -1455,7 +1455,7 @@ sal_Bool ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMem _pIndexes->dropByIndex(--i); } } - catch(SQLException) + catch(const SQLException&) { } } @@ -1467,7 +1467,7 @@ sal_Bool ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMem ::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment > () ); aDeleteContent.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), makeAny( sal_Bool( sal_True ) ) ); } - catch(Exception&) + catch(const Exception&) { // silently ignore this .... } @@ -1979,11 +1979,11 @@ sal_Bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,c break; } } - catch( SQLException& ) + catch( const SQLException& ) { throw; } - catch ( Exception& ) + catch ( const Exception& ) { m_pColumns->getByIndex(i) >>= xCol; OSL_ENSURE( xCol.is(), "ODbaseTable::UpdateBuffer column is null!" ); @@ -2333,7 +2333,7 @@ namespace if(aValues.getLength() && aValues[0].hasValue()) throw Exception(); } - catch(Exception&) + catch(const Exception&) { throw ElementExistException(newName,NULL); } diff --git a/connectivity/source/drivers/evoab2/NDriver.cxx b/connectivity/source/drivers/evoab2/NDriver.cxx index 855f0be63242..cee7f7dc8933 100644 --- a/connectivity/source/drivers/evoab2/NDriver.cxx +++ b/connectivity/source/drivers/evoab2/NDriver.cxx @@ -71,12 +71,15 @@ void OEvoabDriver::disposing() for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) { Reference< XComponent > xComp(i->get(), UNO_QUERY); - if (xComp.is()) { - try { - xComp->dispose(); + if (xComp.is()) + { + try + { + xComp->dispose(); } - catch (com::sun::star::lang::DisposedException e) { - xComp.clear(); + catch (const com::sun::star::lang::DisposedException&) + { + xComp.clear(); } } } diff --git a/connectivity/source/drivers/evoab2/NServices.cxx b/connectivity/source/drivers/evoab2/NServices.cxx index 87e0831513e4..8c28d56c36c9 100644 --- a/connectivity/source/drivers/evoab2/NServices.cxx +++ b/connectivity/source/drivers/evoab2/NServices.cxx @@ -77,7 +77,7 @@ struct ProviderRequest { xRet = creator( xServiceManager, sImplementationName,Factory, Services,0); } - catch(::com::sun::star::uno::Exception) + catch(const ::com::sun::star::uno::Exception&) { OSL_FAIL("Service Creation Exception"); } diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx index 04f15cab4a21..b102481b4fe3 100644 --- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx @@ -90,7 +90,7 @@ SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStor { xFlush->flush(); } - catch(Exception&) + catch(const Exception&) { OSL_FAIL( "NativeStorageAccess::close: caught an exception while flushing!" ); } @@ -171,7 +171,7 @@ jint read_from_storage_stream( JNIEnv * env, jobject /*obj_this*/, jstring name, { nBytesRead = xIn->readBytes(aData,1); } - catch(Exception& e) + catch(const Exception& e) { StorageContainer::throwJavaException(e,env); return -1; @@ -249,7 +249,7 @@ jint read_from_storage_stream_into_buffer( JNIEnv * env, jobject /*obj_this*/,js { nBytesRead = xIn->readBytes(aData, len); } - catch(Exception& e) + catch(const Exception& e) { StorageContainer::throwJavaException(e,env); return -1; @@ -317,7 +317,7 @@ SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStor { nBytesRead = xIn->readBytes(aData, 4); } - catch(Exception& e) + catch(const Exception& e) { StorageContainer::throwJavaException(e,env); return -1; @@ -464,7 +464,7 @@ void write_to_storage_stream_from_buffer( JNIEnv* env, jobject /*obj_this*/, jst "No OutputStream"); } } - catch(Exception& e) + catch(const Exception& e) { OSL_FAIL("Exception caught! : write [BII)V"); StorageContainer::throwJavaException(e,env); @@ -523,9 +523,9 @@ void write_to_storage_stream( JNIEnv* env, jobject /*obj_this*/, jstring name, j "No OutputStream"); } } - catch(Exception& e) + catch(const Exception& e) { - OSL_FAIL("Exception catched! : writeBytes(aData);"); + OSL_FAIL("Exception caught! : writeBytes(aData);"); StorageContainer::throwJavaException(e,env); } } diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx index f8bc5c53b0ce..9edd67bdc4f0 100644 --- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx @@ -79,21 +79,19 @@ namespace connectivity { ::comphelper::disposeComponent(m_xOutputStream); } - catch(DisposedException&) + catch(const DisposedException&) { } - catch(const Exception& e) + catch(const Exception&) { - OSL_UNUSED( e ); OSL_FAIL("Could not dispose OutputStream"); } m_xOutputStream.clear(); } } - catch(Exception& ex) + catch(const Exception&) { - OSL_UNUSED( ex ); - OSL_FAIL("Exception catched!"); + OSL_FAIL("Exception caught!"); } } // ----------------------------------------------------------------------------- @@ -245,7 +243,7 @@ namespace connectivity xTrans->commit(); } } - catch(Exception&) + catch(const Exception&) { } rMap.erase(aFind); @@ -281,7 +279,7 @@ namespace connectivity { pHelper.reset(new StreamHelper(aStoragePair.first.first->openStreamElement(sName,_nMode))); } - catch(Exception& ) + catch(const Exception&) { ::rtl::OUString sStrippedName = removeOldURLPrefix(sOrgName); @@ -292,7 +290,7 @@ namespace connectivity { bIsStream = aStoragePair.first.first->isStreamElement(sStrippedName); } - catch(Exception& ) + catch(const Exception&) { bIsStream = sal_False; } @@ -303,7 +301,7 @@ namespace connectivity } aFind->second.second.insert(TStreamMap::value_type(sName,pHelper)); } - catch(Exception& e) + catch(const Exception& e) { #if OSL_DEBUG_LEVEL > 0 ::rtl::OString sMessage( "[HSQLDB-SDBC] caught an exception while opening a stream\n" ); diff --git a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx index 9bd28fa0b0d4..8a719ee3f638 100644 --- a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx +++ b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx @@ -76,22 +76,22 @@ SAL_DLLPUBLIC_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Storag { aStoragePair.first.first->renameElement(sOldName,StorageContainer::removeURLPrefix(sName,aStoragePair.first.second)); } - catch(Exception&) + catch(const Exception&) { } } } - catch(NoSuchElementException&) + catch(const NoSuchElementException&) { } return aStoragePair.first.first->isStreamElement(StorageContainer::removeURLPrefix(sName,aStoragePair.first.second)); } - catch(NoSuchElementException&) + catch(const NoSuchElementException&) { } - catch(Exception& e) + catch(const Exception& e) { - OSL_FAIL("Exception catched! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement"); + OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement"); if (JNI_FALSE != env->ExceptionCheck()) env->ExceptionClear(); ::rtl::OString cstr( ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_JAVA_UTF8 ) ); @@ -123,14 +123,14 @@ SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFil { aStoragePair.first.first->removeElement(StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,name),aStoragePair.first.second)); } - catch(NoSuchElementException&) + catch(const NoSuchElementException&) { if (JNI_FALSE != env->ExceptionCheck()) env->ExceptionClear(); } - catch(Exception& e) + catch(const Exception& e) { - OSL_FAIL("Exception catched! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement"); + OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement"); StorageContainer::throwJavaException(e,env); } } @@ -168,12 +168,12 @@ SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFil } #endif } - catch(NoSuchElementException&) + catch(const NoSuchElementException&) { } - catch(Exception& e) + catch(const Exception& e) { - OSL_FAIL("Exception catched! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement"); + OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement"); StorageContainer::throwJavaException(e,env); } } diff --git a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx index 28711c7bf277..3fb691d5524a 100644 --- a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx +++ b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx @@ -183,15 +183,15 @@ SAL_DLLPUBLIC_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNa } while (tmpLongVal > 0); } - catch(Exception& ) + catch(const Exception&) { } return n - tmpLongVal; } - catch(Exception& e) + catch(const Exception& e) { - OSL_FAIL("Exception catched! : skip();"); + OSL_FAIL("Exception caught! : skip();"); StorageContainer::throwJavaException(e,env); } } @@ -232,9 +232,9 @@ SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNat #endif return nAvailable; } - catch(Exception& e) + catch(const Exception& e) { - OSL_FAIL("Exception caught! : available();"); + OSL_FAIL("Exception caught! : available();"); StorageContainer::throwJavaException(e,env); } } @@ -276,9 +276,9 @@ SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNat { nBytesRead = xIn->readBytes(aData,nLen); } - catch(Exception& e) + catch(const Exception& e) { - OSL_FAIL("Exception catched! : skip();"); + OSL_FAIL("Exception caught! : skip();"); StorageContainer::throwJavaException(e,env); } diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index a2d9d453f20a..4ecf3f9678bd 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -809,7 +809,7 @@ void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, con } } } - catch(Exception) + catch(const Exception&) { ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateBinaryStream", *this ); } @@ -841,7 +841,7 @@ void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex, } } } - catch(Exception) + catch(const Exception&) { ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateCharacterStream", *this ); } @@ -899,7 +899,7 @@ void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, co } } } - catch(Exception) + catch(const Exception&) { updateObject( columnIndex,x); } @@ -1061,7 +1061,7 @@ void java_sql_ResultSet::getFastPropertyValue( break; } } - catch(Exception&) + catch(const Exception&) { } } diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx index e789f4bd111b..347924d32d23 100644 --- a/connectivity/source/drivers/odbcbase/OResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx @@ -122,7 +122,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) : m_pRowStatusArray = new SQLUSMALLINT[1]; // the default value N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER); } - catch(Exception&) + catch(const Exception&) { // we don't want our result destroy here } SQLINTEGER nCurType = 0; @@ -134,7 +134,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) : (nValueLen & SQL_CA2_CRC_EXACT) != SQL_CA2_CRC_EXACT) m_pSkipDeletedSet = new OSkipDeletedSet(this); } - catch(Exception&) + catch(const Exception&) { // we don't want our result destroy here } try @@ -143,7 +143,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) : OTools::GetInfo(m_pStatement->getOwnConnection(),m_aConnectionHandle,SQL_GETDATA_EXTENSIONS,nValueLen,NULL); m_bFetchData = !((SQL_GD_ANY_ORDER & nValueLen) == SQL_GD_ANY_ORDER && nCurType != SQL_CURSOR_FORWARD_ONLY); } - catch(Exception&) + catch(const Exception&) { // we don't want our result destroy here m_bFetchData = sal_True; } @@ -155,7 +155,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) : m_bUseFetchScroll = ( N3SQLGetFunctions(m_aConnectionHandle,SQL_API_SQLFETCHSCROLL,&nSupported) == SQL_SUCCESS && nSupported == 1 ); } } - catch(Exception&) + catch(const Exception&) { m_bUseFetchScroll = sal_False; } @@ -546,7 +546,7 @@ sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLExcepti const ORowSetValue& aValue = getValue(columnIndex,SQL_C_SBIGINT,&nRet,sizeof nRet); return (&aValue == &m_aEmptyValue) ? nRet : (sal_Int64)aValue; } - catch(SQLException&) + catch(const SQLException&) { nRet = getString(columnIndex).toInt64(); } @@ -873,7 +873,7 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) { OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this); } - catch(SQLException e) + catch(const SQLException&) { nRet = unbind(); throw; @@ -1260,7 +1260,7 @@ Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& *pRet = 1; } } - catch(SQLException&) + catch(const SQLException&) { *pRet = 0; } @@ -1351,7 +1351,7 @@ sal_Bool OResultSet::isBookmarkable() const break; } } - catch(Exception&) + catch(const Exception&) { return sal_False; } diff --git a/connectivity/source/drivers/odbcbase/OStatement.cxx b/connectivity/source/drivers/odbcbase/OStatement.cxx index 8a92fa87911c..dee89e50f280 100644 --- a/connectivity/source/drivers/odbcbase/OStatement.cxx +++ b/connectivity/source/drivers/odbcbase/OStatement.cxx @@ -62,9 +62,9 @@ using namespace ::comphelper; { \ THROW_SQL(nRetCode); \ } \ - catch(SQLException&) \ + catch(const SQLException&) \ { \ - OSL_FAIL("Exception in odbc catched"); \ + OSL_FAIL("Exception in odbc caught"); \ } #endif @@ -269,7 +269,7 @@ SQLLEN OStatement_Base::getRowCount () throw( SQLException) try { THROW_SQL(N3SQLRowCount(m_aStatementHandle,&numRows)); } - catch (SQLException&) + catch (const SQLException&) { } return numRows; @@ -305,7 +305,7 @@ sal_Bool OStatement_Base::lockIfNecessary (const ::rtl::OUString& sql) throw( SQ SQLINTEGER nLock = SQL_CONCUR_LOCK; THROW_SQL(N3SQLSetStmtAttr(m_aStatementHandle, SQL_CONCURRENCY,(SQLPOINTER)(sal_IntPtr)nLock,SQL_IS_UINTEGER)); } - catch (SQLWarning& warn) + catch (const SQLWarning& warn) { // Catch any warnings and place on the warning stack setWarning (warn); @@ -346,7 +346,7 @@ sal_Int32 OStatement_Base::getColumnCount () throw( SQLException) try { THROW_SQL(N3SQLNumResultCols(m_aStatementHandle,&numCols)); } - catch (SQLException&) + catch (const SQLException&) { } return numCols; @@ -380,7 +380,7 @@ sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(S try { THROW_SQL(N3SQLExecDirect(m_aStatementHandle, (SDB_ODBC_CHAR*)aSql.getStr(),aSql.getLength())); } - catch (SQLWarning& ex) { + catch (const SQLWarning& ex) { // Save pointer to warning and save with ResultSet // object once it is created. @@ -617,7 +617,7 @@ sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, Runtim try { hasResultSet = N3SQLMoreResults(m_aStatementHandle) == SQL_SUCCESS; } - catch (SQLWarning &ex) { + catch (const SQLWarning &ex) { // Save pointer to warning and save with ResultSet // object once it is created. @@ -1148,7 +1148,7 @@ SQLUINTEGER OStatement_Base::getCursorProperties(SQLINTEGER _nCursorType,sal_Boo OTools::GetInfo(getOwnConnection(),getConnectionHandle(),nAskFor,nValueLen,NULL); } - catch(Exception&) + catch(const Exception&) { // we don't want our result destroy here nValueLen = 0; } |