diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-16 15:37:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-17 08:19:01 +0200 |
commit | 5aa942f3a5bf83e0426438913acc040abb6a329f (patch) | |
tree | 981c11b9b63b87e254b5a8c70f234fd2e95b0042 /sfx2 | |
parent | f41a55474cb6217560af81ae99c3e2fe1aca5215 (diff) |
loplugin:logexceptionnicely in sfx2
Change-Id: Ia638b94a7859c5dddca82111e7cbe753d7dde631
Reviewed-on: https://gerrit.libreoffice.org/74114
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/bastyp/helper.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/control/recentdocsview.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/control/thumbnailview.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/doc/guisaveas.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/doc/objcont.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/view/classificationhelper.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/view/ipclient.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 5 |
15 files changed, 73 insertions, 67 deletions
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 1535f0c4a2da..90f584c3cf7e 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -190,9 +190,9 @@ namespace // and the bibliography is assumed to work return css::sdbc::DriverManager::create(comphelper::getProcessComponentContext()).is(); } - catch (Exception & e) + catch (const Exception &) { - SAL_INFO("sfx.appl", "assuming Base to be missing; caught " << e); + TOOLS_INFO_EXCEPTION("sfx.appl", "assuming Base to be missing"); return false; } } @@ -213,11 +213,9 @@ namespace SolarMutexGuard aGuard; executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, RESTART_REASON_BIBLIOGRAPHY_INSTALL); } - catch (const Exception & e) + catch (const Exception &) { - SAL_INFO( - "sfx.appl", - "trying to install LibreOffice Base, caught " << e); + TOOLS_INFO_EXCEPTION("sfx.appl", "trying to install LibreOffice Base"); } return; } @@ -230,10 +228,9 @@ namespace SfxViewFrame::Current()->GetDispatcher()->ExecuteList(SID_OPENDOC, SfxCallMode::ASYNCHRON, { &aURL, &aRef, &aTarget }); } - catch (const Exception & e) + catch (const Exception &) { - SAL_INFO( "sfx.appl", - "trying to load bibliography database, caught " << e); + TOOLS_INFO_EXCEPTION( "sfx.appl", "trying to load bibliography database"); } } } diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index ee05b9e56079..f77f5971fd65 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -109,9 +109,9 @@ std::vector<OUString> SfxContentHelper::GetResultSet( const OUString& rURL ) } } } - catch( const uno::Exception& e ) + catch( const uno::Exception& ) { - SAL_WARN( "sfx.bastyp", "GetResultSet: " << e ); + TOOLS_WARN_EXCEPTION( "sfx.bastyp", "GetResultSet"); } return aList; diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 3156d66ca0b8..51674e4e808d 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -25,6 +25,7 @@ #include <sfx2/templatelocalview.hxx> #include <sfx2/app.hxx> #include <sfx2/sfxresid.hxx> +#include <tools/diagnose_ex.h> #include <unotools/historyoptions.hxx> #include <vcl/builderfactory.hxx> #include <vcl/event.hxx> @@ -86,11 +87,10 @@ bool IsDocEncrypted(const OUString& rURL) } catch( uno::Exception& ) {} } } - catch (const uno::Exception& rException) + catch (const uno::Exception&) { - SAL_WARN("sfx", - "caught exception trying to find out if doc is encrypted" - << rURL << ": " << rException); + TOOLS_WARN_EXCEPTION("sfx", + "caught exception trying to find out if doc is encrypted" << rURL); } return bIsEncrypted; diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index e669a26148b9..5a9027829edb 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -32,6 +32,7 @@ #include <rtl/ustring.hxx> #include <sal/log.hxx> #include <svtools/optionsdrawinglayer.hxx> +#include <tools/diagnose_ex.h> #include <unotools/ucbstreamhelper.hxx> #include <vcl/decoview.hxx> #include <vcl/svapp.hxx> @@ -1181,11 +1182,10 @@ BitmapEx ThumbnailView::readThumbnail(const OUString &msURL) } } } - catch (const uno::Exception& rException) + catch (const uno::Exception&) { - SAL_WARN("sfx", - "caught exception while trying to access Thumbnail/thumbnail.png of " - << msURL << ": " << rException); + TOOLS_WARN_EXCEPTION("sfx", + "caught exception while trying to access Thumbnail/thumbnail.png of " << msURL); } try @@ -1208,18 +1208,18 @@ BitmapEx ThumbnailView::readThumbnail(const OUString &msURL) } } } - catch (const uno::Exception& rException) + catch (const uno::Exception&) { - SAL_WARN("sfx", - "caught exception while trying to access Thumbnails/thumbnail.png of " - << msURL << ": " << rException); + TOOLS_WARN_EXCEPTION("sfx", + "caught exception while trying to access Thumbnails/thumbnail.png of " << msURL); } } - catch (const uno::Exception& rException) + catch (const uno::Exception&) { + css::uno::Any ex( cppu::getCaughtException() ); SAL_WARN("sfx", "caught exception while trying to access thumbnail of " - << msURL << ": " << rException); + << msURL << ": " << exceptionToString(ex)); } // Extract the image from the stream. diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 578b1f74e41f..7d2ed6faf10b 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -67,6 +67,7 @@ #include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> #include <tools/datetime.hxx> +#include <tools/diagnose_ex.h> #include <osl/mutex.hxx> #include <comphelper/fileformat.h> #include <cppuhelper/basemutex.hxx> @@ -2046,9 +2047,9 @@ void SAL_CALL SfxDocumentMetaData::setModified( sal_Bool bModified ) event); } catch (const css::uno::RuntimeException &) { throw; - } catch (const css::uno::Exception & e) { + } catch (const css::uno::Exception &) { // ignore - SAL_WARN("sfx.doc", "setModified: " << e); + TOOLS_WARN_EXCEPTION("sfx.doc", "setModified"); } } else { if (xMB.is()) { diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 265fd4edd5b4..ad63078a44fb 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2319,9 +2319,9 @@ void SfxMedium::Transfer_Impl() aLockContent.lock(); } } - catch ( css::uno::Exception & e ) + catch ( css::uno::Exception & ) { - SAL_WARN( "sfx.doc", "LOCK not working while re-issuing it. Exception message: " << e ); + TOOLS_WARN_EXCEPTION( "sfx.doc", "LOCK not working while re-issuing it" ); } } catch ( const css::ucb::CommandAbortedException& ) @@ -3799,10 +3799,12 @@ bool SfxMedium::SignDocumentContentUsingCertificate(bool bHasValidDocumentSignat { xWriteableZipStor = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( ZIP_STORAGE_FORMAT_STRING, pImpl->xStream ); } - catch (const io::IOException& rException) + catch (const io::IOException&) { if (bODF) - SAL_WARN("sfx.doc", "ODF stream is not a zip storage: " << rException); + { + TOOLS_WARN_EXCEPTION("sfx.doc", "ODF stream is not a zip storage"); + } } if ( !xWriteableZipStor.is() && bODF ) @@ -3924,10 +3926,12 @@ bool SfxMedium::SignContents_Impl(weld::Window* pDialogParent, { xWriteableZipStor = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( ZIP_STORAGE_FORMAT_STRING, pImpl->xStream ); } - catch (const io::IOException& rException) + catch (const io::IOException&) { if (bODF) - SAL_WARN("sfx.doc", "ODF stream is not a zip storage: " << rException); + { + TOOLS_WARN_EXCEPTION("sfx.doc", "ODF stream is not a zip storage"); + } } if ( !xWriteableZipStor.is() && bODF ) diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 23257dbc5949..f33f92b327b4 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -432,9 +432,8 @@ void SfxDocTplService_Impl::init_Impl() try { m_xDocProps.set(document::DocumentProperties::create( ::comphelper::getProcessComponentContext())); - } catch (uno::RuntimeException const& e) { - SAL_WARN("sfx.doc", "SfxDocTplService_Impl::init_Impl: " - "cannot create DocumentProperties service:" << e); + } catch (uno::RuntimeException const&) { + TOOLS_WARN_EXCEPTION("sfx.doc", "SfxDocTplService_Impl::init_Impl: cannot create DocumentProperties service:"); } OUString const aService = SERVICENAME_TYPEDETECTION; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 614c35e3459f..fd92486cc1d3 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -63,6 +63,7 @@ #include <unotools/saveopt.hxx> #include <svtools/miscopt.hxx> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> @@ -632,9 +633,9 @@ bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName ) { throw; } - catch( const uno::Exception& e ) + catch( const uno::Exception& ) { - SAL_WARN("sfx.doc", "ignoring " << e); + TOOLS_WARN_EXCEPTION("sfx.doc", "ignoring"); } return bDialogUsed; @@ -1418,10 +1419,9 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo { aModelData.GetStorable2()->storeSelf( aModelData.GetMediaDescr().getAsConstPropertyValueList() ); } - catch (const lang::IllegalArgumentException& e) + catch (const lang::IllegalArgumentException&) { - SAL_WARN("sfx.doc", "Ignoring parameters! " - "ModelData considers this illegal: " << e); + TOOLS_WARN_EXCEPTION("sfx.doc", "Ignoring parameters! ModelData considers this illegal"); aModelData.GetStorable()->store(); } } @@ -1783,9 +1783,9 @@ void SfxStoringHelper::SetDocInfoState( xDocPropsToFill->setEditingDuration(i_xOldDocProps->getEditingDuration()); // other attributes e.g. DocumentStatistics are not editable from dialog } - catch (const uno::Exception& e) + catch (const uno::Exception&) { - SAL_INFO("sfx.doc", "SetDocInfoState: caught " << e); + TOOLS_INFO_EXCEPTION("sfx.doc", "SetDocInfoState"); } // set the modified flag back if required diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index bdd117bc73e3..382583dbb321 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -40,6 +40,7 @@ #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> #include <tools/datetime.hxx> +#include <tools/diagnose_ex.h> #include <rtl/uri.hxx> #include <math.h> #include <sal/log.hxx> @@ -466,9 +467,9 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) aTemplDate = xTemplateDocProps->getModificationDate(); bOK = true; } - catch (const Exception& e) + catch (const Exception&) { - SAL_INFO("sfx.doc", e); + TOOLS_INFO_EXCEPTION("sfx.doc", ""); } // if modify date was read successfully diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 7c7a9f0dfed6..a7b8368f0034 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/security/DocumentSignatureInformation.hpp> #include <com/sun/star/security/DocumentDigitalSignatures.hpp> +#include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <svl/whiter.hxx> #include <svl/intitem.hxx> @@ -861,8 +862,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } catch( const task::ErrorCodeIOException& aErrorEx ) { + TOOLS_WARN_EXCEPTION( "sfx.doc", "Fatal IO error during save"); nErrorCode = ErrCode(aErrorEx.ErrCode); - SAL_WARN( "sfx.doc", "Fatal IO error during save " << aErrorEx ); } catch( Exception& ) { diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 00224f3cbda2..f0bb29b70441 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -662,9 +662,9 @@ BasicManager* SfxObjectShell::GetBasicManager() const if ( !pBasMgr ) pBasMgr = SfxApplication::GetBasicManager(); } - catch (const css::ucb::ContentCreationException& e) + catch (const css::ucb::ContentCreationException&) { - SAL_WARN("sfx.doc", "caught " << e); + TOOLS_WARN_EXCEPTION("sfx.doc", ""); } #endif return pBasMgr; @@ -729,9 +729,9 @@ Reference< XLibraryContainer > SfxObjectShell::GetDialogContainer() if ( pBasMgr ) return pBasMgr->GetDialogLibraryContainer().get(); } - catch (const css::ucb::ContentCreationException& e) + catch (const css::ucb::ContentCreationException&) { - SAL_WARN("sfx.doc", "caught " << e); + TOOLS_WARN_EXCEPTION("sfx.doc", ""); } SAL_WARN("sfx.doc", "SfxObjectShell::GetDialogContainer: falling back to the application - is this really expected here?"); @@ -753,9 +753,9 @@ Reference< XLibraryContainer > SfxObjectShell::GetBasicContainer() if ( pBasMgr ) return pBasMgr->GetScriptLibraryContainer().get(); } - catch (const css::ucb::ContentCreationException& e) + catch (const css::ucb::ContentCreationException&) { - SAL_WARN("sfx.doc", "caught " << e); + TOOLS_WARN_EXCEPTION("sfx.doc", ""); } } SAL_WARN("sfx.doc", "SfxObjectShell::GetBasicContainer: falling back to the application - is this really expected here?"); @@ -816,9 +816,9 @@ void SfxObjectShell::InitBasicManager_Impl() { pImpl->aBasicManager.reset( BasicManagerRepository::getDocumentBasicManager( GetModel() ) ); } - catch (const css::ucb::ContentCreationException& e) + catch (const css::ucb::ContentCreationException&) { - SAL_WARN("sfx.doc", "caught " << e); + TOOLS_WARN_EXCEPTION("sfx.doc", ""); } DBG_ASSERT( pImpl->aBasicManager.isValid(), "SfxObjectShell::InitBasicManager_Impl: did not get a BasicManager!" ); pImpl->bBasicInitialized = true; diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 34c22ca63546..cb4b80957c1c 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -43,6 +43,7 @@ #include <vcl/uitest/eventdescription.hxx> #include <vcl/svapp.hxx> #include <splitwin.hxx> +#include <tools/diagnose_ex.h> #include <tools/link.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <comphelper/processfactory.hxx> @@ -903,9 +904,9 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement ( return xUIElement; } - catch(const Exception& rException) + catch(const Exception&) { - SAL_WARN("sfx.sidebar", "Cannot create panel " << rsImplementationURL << ": " << rException); + TOOLS_WARN_EXCEPTION("sfx.sidebar", "Cannot create panel " << rsImplementationURL); return nullptr; } } diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index 492f5819f5d8..db1f0090c4ec 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -35,6 +35,7 @@ #include <sfx2/sfxresid.hxx> #include <sfx2/viewfrm.hxx> #include <tools/datetime.hxx> +#include <tools/diagnose_ex.h> #include <unotools/datetime.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -408,9 +409,9 @@ void SfxClassificationHelper::Impl::parsePolicy() { xParser->parseStream(aParserInput); } - catch (const xml::sax::SAXParseException& rException) + catch (const xml::sax::SAXParseException&) { - SAL_WARN("sfx.view", "parsePolicy() failed: " << rException); + TOOLS_WARN_EXCEPTION("sfx.view", "parsePolicy() failed"); } m_aCategories = xClassificationParser->m_aCategories; m_aMarkings = xClassificationParser->m_aMarkings; @@ -466,9 +467,9 @@ void SfxClassificationHelper::Impl::pushToDocumentProperties() else xPropertyContainer->addProperty(rLabel.first, beans::PropertyAttribute::REMOVABLE, uno::makeAny(rLabel.second)); } - catch (const uno::Exception& rException) + catch (const uno::Exception&) { - SAL_WARN("sfx.view", "pushDocumentProperties() failed for property " << rLabel.first << ": " << rException); + TOOLS_WARN_EXCEPTION("sfx.view", "pushDocumentProperties() failed for property " << rLabel.first); } } } diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 47064b004004..07fd91bbdd5c 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -62,6 +62,7 @@ #include <toolkit/awt/vclxwindow.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/convert.hxx> +#include <tools/diagnose_ex.h> #include <tools/fract.hxx> #include <tools/gen.hxx> #include <svl/rectitem.hxx> @@ -959,9 +960,9 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) m_xImp->m_aScaleHeight = Fraction( aScaledArea.GetHeight(), aNewSize.Height() ); } } - catch (uno::Exception const& e) + catch (uno::Exception const&) { - SAL_WARN("embeddedobj", "SfxInPlaceClient::DoVerb: -9 fallback path: " << e); + TOOLS_WARN_EXCEPTION("embeddedobj", "SfxInPlaceClient::DoVerb: -9 fallback path"); nError = ERRCODE_SO_GENERALERROR; } } @@ -971,10 +972,9 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) // TODO/LATER: it would be nice to be able to provide the current target state outside nError = ERRCODE_SO_CANNOT_DOVERB_NOW; } - catch (uno::Exception const& e) + catch (uno::Exception const&) { - SAL_WARN("embeddedobj", "SfxInPlaceClient::DoVerb:" - " exception caught: " << e); + TOOLS_WARN_EXCEPTION("embeddedobj", "SfxInPlaceClient::DoVerb"); nError = ERRCODE_SO_GENERALERROR; //TODO/LATER: better error handling diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 3727f254a7fe..d8406ecd4313 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -47,6 +47,7 @@ #include <cppuhelper/implbase.hxx> #include <osl/file.hxx> +#include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <unotools/tempfile.hxx> #include <unotools/pathoptions.hxx> @@ -1684,9 +1685,9 @@ void SfxViewShell::CheckIPClient_Impl( { pIPClient->GetObject()->changeState( embed::EmbedStates::INPLACE_ACTIVE ); } - catch (const uno::Exception& e) + catch (const uno::Exception&) { - SAL_WARN("sfx.view", "SfxViewShell::CheckIPClient_Impl: " << e); + TOOLS_WARN_EXCEPTION("sfx.view", "SfxViewShell::CheckIPClient_Impl"); } } } |