diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-15 23:56:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-15 23:56:45 +0100 |
commit | c54a2f16efbf241623deb92c822df70c14ec52ee (patch) | |
tree | 7c33e205292033687f07bd8c728e1bc24c288015 | |
parent | 84d23d37ac4cbe65021170389440eb6019acd121 (diff) |
catch by const reference
-rw-r--r-- | sw/source/core/layout/dumpfilter.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/txtnode/fmtatr2.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltexte.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbmgr.cxx | 64 | ||||
-rw-r--r-- | sw/source/ui/vba/vbadocument.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/vba/vbafield.cxx | 3 |
7 files changed, 53 insertions, 49 deletions
diff --git a/sw/source/core/layout/dumpfilter.cxx b/sw/source/core/layout/dumpfilter.cxx index 6fe482b2b25b..b5ee4eeb4992 100644 --- a/sw/source/core/layout/dumpfilter.cxx +++ b/sw/source/core/layout/dumpfilter.cxx @@ -77,7 +77,7 @@ namespace strncpy( ( char * ) seq.getArray() , sBuffer, nLen ); xOut->writeBytes( seq ); } - catch ( uno::Exception ) + catch (const uno::Exception&) { written = -1; } @@ -94,7 +94,7 @@ namespace uno::Reference< io::XOutputStream > xOut( pObj, uno::UNO_QUERY_THROW ); xOut->closeOutput( ); } - catch ( uno::Exception ) + catch (const uno::Exception&) { result = -1; } diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index e90646bc24bf..58e56feadfce 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -89,7 +89,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const String& rFile ) refStg = comphelper::OStorageHelper::GetStorageFromURL( rFile, embed::ElementModes::READWRITE ); bReadOnly = sal_False; } - catch( const uno::Exception& ) + catch(const uno::Exception&) { //couldn't open the file - maybe it's readonly } @@ -99,7 +99,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const String& rFile ) { refStg = comphelper::OStorageHelper::GetStorageFromURL( rFile, embed::ElementModes::READ ); } - catch( const uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL("exception while creating AutoText storage"); } @@ -194,7 +194,7 @@ sal_uLong SwXMLTextBlocks::Delete( sal_uInt16 n ) xTrans->commit(); return 0; } - catch ( uno::Exception) + catch (const uno::Exception&) { return ERR_SWG_WRITE_ERROR; } @@ -230,9 +230,8 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, con { xBlkRoot->renameElement ( aOldName, aPackageName ); } - catch( const container::ElementExistException& rEx ) + catch(const container::ElementExistException&) { - (void)rEx; } } uno::Reference < embed::XTransactedObject > xTrans( xBlkRoot, uno::UNO_QUERY ); @@ -279,7 +278,7 @@ sal_uLong SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, String& rShort, uno::Reference < embed::XStorage > rDestRoot = ((SwXMLTextBlocks&)rDestImp).xBlkRoot->openStorageElement( sDestShortName, embed::ElementModes::READWRITE ); rSourceRoot->copyToStorage( rDestRoot ); } - catch ( uno::Exception& ) + catch (const uno::Exception&) { nError = ERR_SWG_WRITE_ERROR; } @@ -311,7 +310,7 @@ sal_uLong SwXMLTextBlocks::StartPutBlock( const String& rShort, const String& rP ::rtl::OUString aMime( SotExchange::GetFormatMimeType( SOT_FORMATSTR_ID_STARWRITER_8 ) ); xRootProps->setPropertyValue( aPropName, uno::makeAny( aMime ) ); } - catch (uno::Exception&) + catch (const uno::Exception&) { } return 0; @@ -372,7 +371,7 @@ sal_uLong SwXMLTextBlocks::PutBlock( SwPaM& , const String& ) xTempStorage->copyToStorage( xRoot ); bOK = bTmpOK; } - catch( uno::Exception& ) + catch(const uno::Exception&) { } @@ -397,7 +396,7 @@ sal_uLong SwXMLTextBlocks::PutBlock( SwPaM& , const String& ) xTmpTrans->commit(); } } - catch (uno::Exception&) + catch (const uno::Exception&) { } @@ -465,7 +464,7 @@ sal_Bool SwXMLTextBlocks::PutMuchEntries( sal_Bool bOn ) bInPutMuchBlocks = sal_False; bRet = sal_True; } - catch (uno::Exception&) + catch (const uno::Exception&) { } } @@ -484,7 +483,7 @@ sal_uLong SwXMLTextBlocks::OpenFile( sal_Bool bRdOnly ) bRdOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE ); InitBlockMode ( refStg ); } - catch ( uno::Exception& ) + catch (const uno::Exception&) { //TODO/LATER: error handling nRet = 1; diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index ed7ab96e35e2..0abbdf6dcbc4 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -814,7 +814,9 @@ void MetaField::GetPrefixAndSuffix( (pShell) ? pShell->GetModel() : 0, uno::UNO_SET_THROW); getPrefixAndSuffix(xModel, xMetaField, o_pPrefix, o_pSuffix); } - } catch (uno::Exception) { + } + catch (const uno::Exception&) + { OSL_FAIL("exception?"); } } diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx index 0646b1b19f0a..e85a5206d7be 100644 --- a/sw/source/filter/xml/xmltexte.cxx +++ b/sw/source/filter/xml/xmltexte.cxx @@ -506,7 +506,7 @@ void SwXMLTextParagraphExport::_exportTextEmbedded( if ( bIsOwnLink ) sURL = xLinkage->getLinkURL(); } - catch( uno::Exception ) + catch(const uno::Exception&) { // TODO/LATER: error handling OSL_FAIL( "Link detection or retrieving of the URL of OOo link is failed!\n" ); diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index d6b30b74a668..5ee9fca2f9c0 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -188,7 +188,7 @@ bool lcl_getCountFromResultSet( sal_Int32& rCount, const uno::Reference<XResultS if( aCount >>= rCount ) return true; } - catch(Exception&) + catch(const Exception&) { } } @@ -282,7 +282,7 @@ sal_Bool lcl_MoveAbsolute(SwDSParam* pParam, long nAbsPos) OSL_FAIL("no absolute positioning available"); } } - catch(Exception aExcept) + catch(const Exception&) { } return bRet; @@ -297,7 +297,7 @@ sal_Bool lcl_GetColumnCnt(SwDSParam* pParam, { xCols = xColsSupp->getColumns(); } - catch( lang::DisposedException& ) + catch(const lang::DisposedException&) { } if(!xCols.is() || !xCols->hasByName(rColumnName)) @@ -377,7 +377,7 @@ sal_Bool SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) if(xComponent.is()) xComponent->addEventListener(pImpl->xDisposeListener); } - catch(Exception&) + catch(const Exception&) { } } @@ -403,7 +403,7 @@ sal_Bool SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc ) pImpl->pMergeData->CheckEndOfDB(); } } - catch(Exception&) + catch(const Exception&) { pImpl->pMergeData->bEndOfDB = sal_True; pImpl->pMergeData->CheckEndOfDB(); @@ -744,7 +744,7 @@ SwNewDBMgr::~SwNewDBMgr() if(xComp.is()) xComp->dispose(); } - catch(const RuntimeException& ) + catch(const RuntimeException&) { //may be disposed already since multiple entries may have used the same connection } @@ -1427,7 +1427,7 @@ sal_uLong SwNewDBMgr::GetColumnFmt( const String& rDBName, { xCols = xColsSupp->getColumns(); } - catch(Exception&) + catch(const Exception&) { OSL_FAIL("Exception in getColumns()"); } @@ -1524,7 +1524,7 @@ sal_uLong SwNewDBMgr::GetColumnFmt( uno::Reference< XDataSource> xSource, } } } - catch( const Exception& ) + catch(const Exception&) { OSL_FAIL("no FormatKey property found"); } @@ -1595,7 +1595,9 @@ uno::Reference< sdbc::XConnection> SwNewDBMgr::GetConnection(const String& rData xConnection = xComplConnection->connectWithCompletion( xHandler ); } } - catch(Exception&) {} + catch(const Exception&) + { + } return xConnection; } @@ -1641,7 +1643,7 @@ uno::Reference< sdbcx::XColumnsSupplier> SwNewDBMgr::GetColumnSupplier(uno::Refe xRowSet->execute(); xRet = Reference<XColumnsSupplier>( xRowSet, UNO_QUERY ); } - catch( const uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL("Exception in SwDBMgr::GetColumnSupplier"); } @@ -1671,7 +1673,7 @@ String SwNewDBMgr::GetDBField(uno::Reference<XPropertySet> xColumnProps, { sRet = xColumn->getString(); } - catch( SQLException& ) + catch(const SQLException&) { } break; @@ -1708,7 +1710,7 @@ String SwNewDBMgr::GetDBField(uno::Reference<XPropertySet> xColumnProps, } } } - catch(Exception& ) + catch(const Exception&) { OSL_FAIL("exception caught"); } @@ -1800,7 +1802,7 @@ sal_Bool SwNewDBMgr::GetColumnCnt(const String& rSourceName, const String& rTabl { nOldRow = pFound->xResultSet->getRow(); } - catch(const Exception& ) + catch(const Exception&) { return sal_False; } @@ -1895,7 +1897,7 @@ sal_Bool SwNewDBMgr::ToNextRecord(SwDSParam* pParam) ++pParam->nSelectionIndex; } } - catch(Exception&) + catch(const Exception&) { } return bRet; @@ -1921,7 +1923,7 @@ sal_uInt32 SwNewDBMgr::GetSelectedRecordId() { nRet = pImpl->pMergeData->xResultSet->getRow(); } - catch(Exception& ) + catch(const Exception&) { } return nRet; @@ -1975,7 +1977,7 @@ sal_Bool SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTa pFound->bScrollable = xMetaData ->supportsResultSetType((sal_Int32)ResultSetType::SCROLL_INSENSITIVE); } - catch(Exception&) + catch(const Exception&) { // DB driver may not be ODBC 3.0 compliant pFound->bScrollable = sal_True; @@ -1995,7 +1997,7 @@ sal_Bool SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTa pFound->CheckEndOfDB(); ++pFound->nSelectionIndex; } - catch (Exception&) + catch (const Exception&) { pFound->xResultSet = 0; pFound->xStatement = 0; @@ -2018,7 +2020,7 @@ uno::Reference< XConnection> SwNewDBMgr::RegisterConnection(rtl::OUString& rData if(xComponent.is()) xComponent->addEventListener(pImpl->xDisposeListener); } - catch(Exception&) + catch(const Exception&) { } } @@ -2057,7 +2059,9 @@ sal_uInt32 SwNewDBMgr::GetSelectedRecordId( else nRet = pFound->xResultSet->getRow(); } - catch(Exception&){} + catch(const Exception&) + { + } } } return nRet; @@ -2082,7 +2086,7 @@ void SwNewDBMgr::CloseAll(sal_Bool bIncludingMerge) if(!bInMerge && pParam->xResultSet.is()) pParam->xResultSet->first(); } - catch(Exception& ) + catch(const Exception&) {} } } @@ -2129,7 +2133,7 @@ SwDSParam* SwNewDBMgr::FindDSData(const SwDBData& rData, sal_Bool bCreate) if(xComponent.is()) xComponent->addEventListener(pImpl->xDisposeListener); } - catch(Exception&) + catch(const Exception&) { } } @@ -2166,7 +2170,7 @@ SwDSParam* SwNewDBMgr::FindDSConnection(const rtl::OUString& rDataSource, sal_B if(xComponent.is()) xComponent->addEventListener(pImpl->xDisposeListener); } - catch(Exception&) + catch(const Exception&) { } } @@ -2377,7 +2381,7 @@ String SwNewDBMgr::LoadAndRegisterDataSource() xNaming->registerObject( sFind, xNewInstance ); } - catch(Exception&) + catch(const Exception&) { } } @@ -2459,9 +2463,8 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, sTempURL = URIHelper::SmartRel2Abs( INetURLObject(), utl::TempFile::CreateTempName() ); xStore->storeToURL( sTempURL, aValues ); } - catch( const uno::Exception& rEx ) + catch(const uno::Exception&) { - (void) rEx; } if( xDocShell->GetError() ) { @@ -2507,7 +2510,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, //! I.e. now that object is responsible for closing the model and doc shell. xClose->close( sal_True ); } - catch ( const uno::Exception& ) + catch (const uno::Exception&) { } } @@ -2535,7 +2538,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, if(xComp.is()) xComp->dispose(); } - catch(const RuntimeException& ) + catch(const RuntimeException&) { //may be disposed already since multiple entries may have used the same connection } @@ -2608,7 +2611,7 @@ void SwNewDBMgr::InsertText(SwWrtShell& rSh, { pDlg->DataToDoc( aSelection , xSource, xConnection, xResSet); } - catch(Exception& ) + catch(const Exception&) { OSL_FAIL("exception caught"); } @@ -2721,7 +2724,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, pImpl->pMergeData->CheckEndOfDB(); } } - catch(Exception&) + catch(const Exception&) { pImpl->pMergeData->bEndOfDB = sal_True; pImpl->pMergeData->CheckEndOfDB(); @@ -2945,9 +2948,8 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, pTargetShell->SttDoc(); } - catch( Exception& rEx) + catch(const Exception&) { - (void)rEx; OSL_FAIL("exception caught in SwNewDBMgr::MergeDocuments"); } DELETEZ(pImpl->pMergeData); diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index 8c7e60e549fb..f43985ee3992 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -126,7 +126,7 @@ SwVbaDocument::Range( const uno::Any& rStart, const uno::Any& rEnd ) throw ( uno xStart = mxTextDocument->getText()->getStart(); xEnd = mxTextDocument->getText()->getEnd(); } - catch( uno::Exception ) + catch(const uno::Exception&) { DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString()); } @@ -503,7 +503,7 @@ SwVbaDocument::getFormControls() // implementation detail xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW ); } - catch( uno::Exception& ) + catch(const uno::Exception&) { } return xFormControls; diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx index 0ff4295a1218..27a682ebe762 100644 --- a/sw/source/ui/vba/vbafield.cxx +++ b/sw/source/ui/vba/vbafield.cxx @@ -556,7 +556,8 @@ sal_Int32 SAL_CALL SwVbaFields::Update() throw (uno::RuntimeException) uno::Reference< util::XRefreshable > xRef( xSupp->getTextFields(), uno::UNO_QUERY_THROW ); xRef->refresh(); nUpdate = 0; - }catch( uno::Exception ) + } + catch(const uno::Exception&) { nUpdate = 1; } |