summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-06-18 09:32:29 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-06-18 11:33:03 +0200
commit399edcb0bca8e1cfc55ca68237cdb470bcc54932 (patch)
treee836d1094bb43291549b6a7ba3915ed2ef98beab
parent7d9ff70206dbd75a7751515b642fbbbc8878c159 (diff)
loplugin:logexceptionnicely in sw
Change-Id: I92c84f5c869e5ccab344f7e3591d68a90a20eefa Reviewed-on: https://gerrit.libreoffice.org/74243 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/core/layout/layact.cxx5
-rw-r--r--sw/source/core/tox/toxhlp.cxx25
-rw-r--r--sw/source/core/view/viewimp.cxx5
-rw-r--r--sw/source/filter/docx/swdocxreader.cxx6
-rw-r--r--sw/source/filter/html/htmlplug.cxx5
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx5
-rw-r--r--sw/source/filter/writer/writer.cxx5
-rw-r--r--sw/source/filter/ww8/docxexport.cxx4
-rw-r--r--sw/source/filter/ww8/ww8toolbar.cxx5
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx5
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx3
-rw-r--r--sw/source/uibase/app/apphdl.cxx14
-rw-r--r--sw/source/uibase/config/StoredChapterNumbering.cxx9
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx20
14 files changed, 64 insertions, 52 deletions
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 174e15699e46..83172f70e56f 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -63,6 +63,7 @@
#include <objectformatter.hxx>
#include <fntcache.hxx>
#include <vector>
+#include <tools/diagnose_ex.h>
// Save some typing work to avoid accessing destroyed pages.
#define XCHECKPAGE \
@@ -1968,9 +1969,9 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, IdleJobType eJob )
bPageValid = bPageValid && !pTextNode->IsSmartTagDirty();
if ( aRepaint.HasArea() )
pImp->GetShell()->InvalidateWindows( aRepaint );
- } catch( const css::uno::RuntimeException& e) {
+ } catch( const css::uno::RuntimeException&) {
// handle smarttag problems gracefully and provide diagnostics
- SAL_WARN( "sw.core", "SMART_TAGS: " << e);
+ TOOLS_WARN_EXCEPTION( "sw.core", "SMART_TAGS");
}
if (Application::AnyInput(VCL_INPUT_ANY & VclInputFlags(~VclInputFlags::TIMER)))
return true;
diff --git a/sw/source/core/tox/toxhlp.cxx b/sw/source/core/tox/toxhlp.cxx
index 7bdd2d3d0130..1c383a757ae0 100644
--- a/sw/source/core/tox/toxhlp.cxx
+++ b/sw/source/core/tox/toxhlp.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/i18n/IndexEntrySupplier.hpp>
#include <toxwrap.hxx>
#include <sal/log.hxx>
+#include <tools/diagnose_ex.h>
using namespace ::com::sun::star;
@@ -31,9 +32,9 @@ IndexEntrySupplierWrapper::IndexEntrySupplierWrapper()
try {
xIES = i18n::IndexEntrySupplier::create(xContext);
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
- SAL_WARN( "sw.core", "IndexEntrySupplierWrapper: Caught " << e );
+ TOOLS_WARN_EXCEPTION( "sw.core", "IndexEntrySupplierWrapper" );
}
}
@@ -49,9 +50,9 @@ OUString IndexEntrySupplierWrapper::GetIndexKey( const OUString& rText,
try {
sRet = xIES->getIndexKey( rText, rTextReading, rLocale );
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
- SAL_WARN( "sw.core", "getIndexKey: Caught " << e );
+ TOOLS_WARN_EXCEPTION( "sw.core", "getIndexKey" );
}
return sRet;
}
@@ -62,9 +63,9 @@ OUString IndexEntrySupplierWrapper::GetFollowingText( bool bMorePages ) const
try {
sRet = xIES->getIndexFollowPageWord( bMorePages, aLcl );
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
- SAL_WARN( "sw.core", "getIndexFollowPageWord: Caught " << e );
+ TOOLS_WARN_EXCEPTION( "sw.core", "getIndexFollowPageWord" );
}
return sRet;
}
@@ -76,9 +77,9 @@ css::uno::Sequence< OUString > IndexEntrySupplierWrapper::GetAlgorithmList( cons
try {
sRet = xIES->getAlgorithmList( rLcl );
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
- SAL_WARN( "sw.core", "getAlgorithmList: Caught " << e );
+ TOOLS_WARN_EXCEPTION( "sw.core", "getAlgorithmList" );
}
return sRet;
}
@@ -91,9 +92,9 @@ bool IndexEntrySupplierWrapper::LoadAlgorithm(
try {
bRet = xIES->loadAlgorithm( rLcl, sSortAlgorithm, nOptions );
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
- SAL_WARN( "sw.core", "loadAlgorithm: Caught " << e );
+ TOOLS_WARN_EXCEPTION( "sw.core", "loadAlgorithm" );
}
return bRet;
}
@@ -109,9 +110,9 @@ sal_Int16 IndexEntrySupplierWrapper::CompareIndexEntry(
nRet = xIES->compareIndexEntry( rText1, rTextReading1, rLocale1,
rText2, rTextReading2, rLocale2 );
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
- SAL_WARN( "sw.core", "compareIndexEntry: Caught " << e );
+ TOOLS_WARN_EXCEPTION( "sw.core", "compareIndexEntry" );
}
return nRet;
}
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 7e0022f53c2b..aba0c251e3da 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -36,6 +36,7 @@
#include <svx/svdundo.hxx>
#include <comphelper/lok.hxx>
#include <sal/log.hxx>
+#include <tools/diagnose_ex.h>
#include <IDocumentLayoutAccess.hxx>
#include <IDocumentDrawModelAccess.hxx>
#include <IDocumentDeviceAccess.hxx>
@@ -302,9 +303,9 @@ void SwViewShellImp::UpdateAccessible()
{
GetAccessibleMap().GetDocumentView();
}
- catch (uno::Exception const& e)
+ catch (uno::Exception const&)
{
- SAL_WARN("sw.a11y", e);
+ TOOLS_WARN_EXCEPTION("sw.a11y", "");
assert(!"SwViewShellImp::UpdateAccessible: unhandled exception");
}
}
diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx
index 4705bc84551a..ea3a2a1065d6 100644
--- a/sw/source/filter/docx/swdocxreader.cxx
+++ b/sw/source/filter/docx/swdocxreader.cxx
@@ -40,6 +40,8 @@
#include <unotextrange.hxx>
#include <sfx2/docfile.hxx>
#include <sal/log.hxx>
+#include <tools/diagnose_ex.h>
+
#define AUTOTEXT_GALLERY "autoTxt"
using namespace css;
@@ -90,9 +92,9 @@ ErrCode SwDOCXReader::Read(SwDoc& rDoc, const OUString& /* rBaseURL */, SwPaM& r
{
xFilter->filter(aDescriptor);
}
- catch (uno::Exception const& e)
+ catch (uno::Exception const&)
{
- SAL_WARN("sw.docx", "SwDOCXReader::Read(): " << e);
+ TOOLS_WARN_EXCEPTION("sw.docx", "SwDOCXReader::Read()");
ret = ERR_SWG_READ_ERROR;
}
pDocShell->SetLoading(SfxLoadedFlags::ALL);
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index ca1eeb9b9ce5..f6a60aff7962 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -35,6 +35,7 @@
#include <svtools/htmlout.hxx>
#include <svtools/htmlkywd.hxx>
#include <svtools/htmltokn.h>
+#include <tools/diagnose_ex.h>
#include <SwAppletImpl.hxx>
#include <fmtornt.hxx>
#include <fmtfsize.hxx>
@@ -1571,9 +1572,9 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame
{
// Even the native data may be missing.
xInStream = xStorage->openStreamElement(aStreamName, embed::ElementModes::READ);
- } catch (const uno::Exception& rException)
+ } catch (const uno::Exception&)
{
- SAL_WARN("sw.html", "OutHTML_FrameFormatOLENodeGrf: failed to open stream element: " << rException);
+ TOOLS_WARN_EXCEPTION("sw.html", "OutHTML_FrameFormatOLENodeGrf: failed to open stream element");
}
if (xInStream.is())
{
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index e987b4488567..bd333ea0d565 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -32,6 +32,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/propertysequence.hxx>
#include <sal/log.hxx>
+#include <tools/diagnose_ex.h>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
@@ -99,9 +100,9 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam
{
xFilter->filter(aDescriptor);
}
- catch (uno::Exception const& e)
+ catch (uno::Exception const&)
{
- SAL_WARN("sw.rtf", "SwRTFReader::Read(): " << e);
+ TOOLS_WARN_EXCEPTION("sw.rtf", "SwRTFReader::Read()");
ret = ERR_SWG_READ_ERROR;
}
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index aa5c9eab397c..be4fbe67571a 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -24,6 +24,7 @@
#include <sfx2/docfile.hxx>
#include <svl/urihelper.hxx>
#include <vcl/graphicfilter.hxx>
+#include <tools/diagnose_ex.h>
#include <editeng/fontitem.hxx>
#include <editeng/eeitem.hxx>
#include <sal/log.hxx>
@@ -251,9 +252,9 @@ ErrCode Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName )
if ( nResult == ERRCODE_NONE )
aRef->Commit();
}
- catch (const css::ucb::ContentCreationException &e)
+ catch (const css::ucb::ContentCreationException &)
{
- SAL_WARN("sw", "Writer::Write caught " << e);
+ TOOLS_WARN_EXCEPTION("sw", "Writer::Write caught");
}
return nResult;
}
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 6d6dd78ad1c9..f11c4cbdd82f 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -430,9 +430,9 @@ OString DocxExport::WriteOLEObject(SwOLEObj& rObject, OUString & io_rProgID)
{
::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
}
- catch (uno::Exception const& e)
+ catch (uno::Exception const&)
{
- SAL_WARN("sw.ww8", "DocxExport::WriteOLEObject: " << e);
+ TOOLS_WARN_EXCEPTION("sw.ww8", "DocxExport::WriteOLEObject");
return OString();
}
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index 1724d2e5bb07..c03777bbbdf8 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -20,6 +20,7 @@
#include <fstream>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
+#include <tools/diagnose_ex.h>
#include <unotools/configmgr.hxx>
#include <vcl/graph.hxx>
#include <map>
@@ -458,9 +459,9 @@ bool SwCTB::ImportCustomToolBar( SwCTBWrapper& rWrapper, CustomToolBarImportHelp
#endif
bRes = true;
}
- catch( const uno::Exception& e )
+ catch( const uno::Exception& )
{
- SAL_INFO("sw.ww8","***** For some reason we have an " << e );
+ TOOLS_INFO_EXCEPTION("sw.ww8","***** For some reason we have an" );
bRes = false;
}
return bRes;
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 3bb59af15849..d5f925903836 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -45,6 +45,7 @@
#include <editeng/langitem.hxx>
#include <svl/numuno.hxx>
#include <svl/stritem.hxx>
+#include <tools/diagnose_ex.h>
#include <vcl/svapp.hxx>
#include <vcl/mnemonic.hxx>
#include <svl/style.hxx>
@@ -1118,9 +1119,9 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
}
}
}
- catch (const Exception& rExcept)
+ catch (const Exception&)
{
- SAL_WARN("sw", rExcept);
+ TOOLS_WARN_EXCEPTION("sw", "");
}
}
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index b5bec37c60d6..fd6c919b2472 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/sdb/XColumn.hpp>
#include <comphelper/string.hxx>
#include <sal/log.hxx>
+#include <tools/diagnose_ex.h>
#include <vector>
#include <globals.hrc>
@@ -179,7 +180,7 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl, Button*, void)
}
catch (const uno::Exception& e)
{
- SAL_WARN("sw", e);
+ TOOLS_WARN_EXCEPTION("sw", "");
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok, e.Message));
xBox->run();
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 98a53fa710f5..a48505ac998d 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -35,6 +35,7 @@
#include <svl/ctloptions.hxx>
#include <svtools/colorcfg.hxx>
#include <svtools/accessibilityoptions.hxx>
+#include <tools/diagnose_ex.h>
#include <unotools/useroptions.hxx>
#include <com/sun/star/document/UpdateDocMode.hpp>
#include <sfx2/docfile.hxx>
@@ -394,11 +395,10 @@ bool lcl_hasAllComponentsAvailable()
{
return css::sdb::TextConnectionSettings::create(comphelper::getProcessComponentContext()).is();
}
- catch (css::uno::Exception & e)
+ catch (const css::uno::Exception &)
{
- SAL_INFO(
- "sw.core",
- "assuming Base to be missing; caught " << e);
+ TOOLS_INFO_EXCEPTION(
+ "sw.core", "assuming Base to be missing; caught ");
return false;
}
}
@@ -417,11 +417,11 @@ void SwMailMergeWizardExecutor::ExecuteMailMergeWizard( const SfxItemSet * pArgs
SolarMutexGuard aGuard;
executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, RESTART_REASON_MAILMERGE_INSTALL);
}
- catch (const css::uno::Exception & e)
+ catch (const css::uno::Exception &)
{
- SAL_INFO(
+ TOOLS_INFO_EXCEPTION(
"sw.core",
- "trying to install LibreOffice Base, caught " << e);
+ "trying to install LibreOffice Base, caught");
auto xRestartManager
= css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext());
if (!xRestartManager->isRestartRequested(false))
diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx
index 7be6460e036d..80439b19031d 100644
--- a/sw/source/uibase/config/StoredChapterNumbering.cxx
+++ b/sw/source/uibase/config/StoredChapterNumbering.cxx
@@ -34,6 +34,7 @@
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
+#include <tools/diagnose_ex.h>
#include <unosett.hxx>
@@ -443,9 +444,9 @@ void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules,
{
exp->ExportRules(charStyles, numRules);
}
- catch (uno::Exception const& e)
+ catch (uno::Exception const&)
{
- SAL_WARN("sw.ui", "ExportStoredChapterNumberingRules: " << e);
+ TOOLS_WARN_EXCEPTION("sw.ui", "ExportStoredChapterNumberingRules");
}
}
@@ -472,9 +473,9 @@ void ImportStoredChapterNumberingRules(SwChapterNumRules & rRules,
{
xParser->parseStream(source);
}
- catch (uno::Exception const& e)
+ catch (uno::Exception const&)
{
- SAL_WARN("sw.ui", "ImportStoredChapterNumberingRules: " << e);
+ TOOLS_WARN_EXCEPTION("sw.ui", "ImportStoredChapterNumberingRules");
}
}
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 99f24e7ca948..ec31fdc6a500 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1794,9 +1794,9 @@ sal_uLong SwDBManager::GetColumnFormat( const OUString& rDBName,
{
xCols = xColsSupp->getColumns();
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
- SAL_WARN("sw.mailmerge", "Exception in getColumns(): " << e);
+ TOOLS_WARN_EXCEPTION("sw.mailmerge", "Exception in getColumns()");
}
if(!xCols.is() || !xCols->hasByName(rColNm))
return nRet;
@@ -1886,9 +1886,9 @@ sal_uLong SwDBManager::GetColumnFormat( uno::Reference< sdbc::XDataSource> const
nRet = nFormat;
bUseDefault = false;
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
- SAL_WARN("sw.mailmerge", "illegal number format key: " << e);
+ TOOLS_WARN_EXCEPTION("sw.mailmerge", "illegal number format key");
}
}
}
@@ -2010,9 +2010,9 @@ uno::Reference< sdbcx::XColumnsSupplier> SwDBManager::GetColumnSupplier(uno::Ref
xRowSet->execute();
xRet.set( xRowSet, uno::UNO_QUERY );
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
- SAL_WARN("sw.mailmerge", "Exception in SwDBManager::GetColumnSupplier: " << e);
+ TOOLS_WARN_EXCEPTION("sw.mailmerge", "Exception in SwDBManager::GetColumnSupplier");
}
return xRet;
@@ -2332,13 +2332,13 @@ static bool lcl_ToNextRecord( SwDSParam* pParam, const SwDBNextRecord action )
++pParam->nSelectionIndex;
bRet = !pParam->bEndOfDB;
}
- catch( const uno::Exception &e )
+ catch( const uno::Exception & )
{
+ // we allow merging with empty databases, so don't warn on init
+ TOOLS_WARN_EXCEPTION_IF(action == SwDBNextRecord::NEXT,
+ "sw.mailmerge", "exception in ToNextRecord()");
pParam->bEndOfDB = true;
bRet = false;
- // we allow merging with empty databases, so don't warn on init
- SAL_WARN_IF(action == SwDBNextRecord::NEXT,
- "sw.mailmerge", "exception in ToNextRecord(): " << e);
}
return bRet;
}