[Libreoffice-commits] core.git: 2 commits - cui/source dbaccess/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 15 10:26:12 UTC 2019


 cui/source/customize/SvxToolbarConfigPage.cxx |   12 ++++++------
 cui/source/customize/cfg.cxx                  |    8 ++++----
 cui/source/customize/cfgutil.cxx              |    5 +++--
 cui/source/dialogs/linkdlg.cxx                |    5 +++--
 cui/source/dialogs/scriptdlg.cxx              |    4 ++--
 cui/source/options/certpath.cxx               |   13 +++++++------
 cui/source/options/optaboutconfig.cxx         |    5 +++--
 cui/source/options/optgdlg.cxx                |    9 +++++----
 cui/source/options/optinet2.cxx               |    5 +++--
 cui/source/options/optjava.cxx                |    4 ++--
 cui/source/options/optpath.cxx                |    4 ++--
 cui/source/options/tsaurls.cxx                |    5 +++--
 dbaccess/source/core/api/RowSetCache.cxx      |   20 ++++++++++----------
 dbaccess/source/filter/xml/xmlfilter.cxx      |    6 ++----
 dbaccess/source/ui/browser/sbagrid.cxx        |    9 +++++----
 dbaccess/source/ui/browser/unodatbr.cxx       |    4 +++-
 16 files changed, 63 insertions(+), 55 deletions(-)

New commits:
commit ec87e11f0e4bb6f53eb0c5d2575f590aea95269f
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jun 14 15:29:16 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jun 15 12:25:00 2019 +0200

    loplugin:logexceptionnicely in dbaccess
    
    Change-Id: I2d702b699c2e61dbb363eff671bb43d4ddbf8ee3
    Reviewed-on: https://gerrit.libreoffice.org/74045
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index ee4491d52606..c93067ab2944 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -135,9 +135,9 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
                             ::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) != ResultSetType::FORWARD_ONLY)
             _xRs->beforeFirst();
     }
-    catch(const SQLException& e)
+    catch(const SQLException&)
     {
-        SAL_WARN("dbaccess.core", "ORowSetCache: " << e);
+        TOOLS_WARN_EXCEPTION("dbaccess.core", "ORowSetCache");
     }
 
     // check if all keys of the updateable table are fetched
@@ -181,9 +181,9 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
                     m_aKeyColumns = pCursor->getJoinedKeyColumns();
                     return;
                 }
-                catch (const Exception& e)
+                catch (const Exception&)
                 {
-                    SAL_WARN("dbaccess.core", "ORowSetCache: " << e);
+                    TOOLS_WARN_EXCEPTION("dbaccess.core", "ORowSetCache");
                 }
                 m_xCacheSet.clear();
             }
@@ -221,9 +221,9 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
                 }
             }
         }
-        catch (Exception const& e)
+        catch (Exception const&)
         {
-            SAL_WARN("dbaccess.core", "ORowSetCache: " << e);
+            TOOLS_WARN_EXCEPTION("dbaccess.core", "ORowSetCache");
         }
     }
 
@@ -249,9 +249,9 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
                 }
             }
         }
-        catch (const SQLException& e)
+        catch (const SQLException&)
         {
-            SAL_WARN("dbaccess.core", "ORowSetCache: " << e);
+            TOOLS_WARN_EXCEPTION("dbaccess.core", "ORowSetCache");
             bNeedKeySet = true;
         }
 
@@ -328,9 +328,9 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
                 if(bNoInsert)
                     m_nPrivileges |= ~Privilege::INSERT; // remove the insert privilege
             }
-            catch (const SQLException& e)
+            catch (const SQLException&)
             {
-                SAL_WARN("dbaccess.core", "ORowSetCache: " << e);
+                TOOLS_WARN_EXCEPTION("dbaccess.core", "ORowSetCache");
                 // we couldn't create a keyset here so we have to create a static cache
                 m_xCacheSet = new OStaticSet(i_nMaxRows);
                 m_xCacheSet->construct(_xRs,i_sRowSetFilter);
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index 27bc17bd762d..355f9cafcf0b 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -115,12 +115,10 @@ static ErrCode ReadThroughComponent(
     {
         xParser->parseStream( aParserInput );
     }
-    catch (const SAXParseException& r)
+    catch (const SAXParseException&)
     {
 #if OSL_DEBUG_LEVEL > 0
-        SAL_WARN("dbaccess", "SAX parse exception caught while importing: " << r << r.LineNumber << "," << r.ColumnNumber);
-#else
-        (void)r;
+        TOOLS_WARN_EXCEPTION("dbaccess", "SAX parse exception caught while importing");
 #endif
         return ErrCode(1);
     }
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 0bf3e8a4fec8..1684ce4ba1dd 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -60,6 +60,7 @@
 #include <svl/itempool.hxx>
 #include <svl/itemset.hxx>
 #include <svl/rngitem.hxx>
+#include <tools/diagnose_ex.h>
 #include <toolkit/helper/vclunohelper.hxx>
 
 #include <vcl/svapp.hxx>
@@ -936,9 +937,9 @@ Reference< XPropertySet >  SbaGridControl::getField(sal_uInt16 nModelPos)
         else
             OSL_FAIL("SbaGridControl::getField getColumns returns NULL or ModelPos is > than count!");
     }
-    catch (const Exception& e)
+    catch (const Exception&)
     {
-        SAL_WARN("dbaccess", "SbaGridControl::getField Exception occurred: " << e);
+        TOOLS_WARN_EXCEPTION("dbaccess", "SbaGridControl::getField Exception occurred");
     }
 
     return xEmptyReturn;
@@ -971,9 +972,9 @@ bool SbaGridControl::IsReadOnlyDB() const
             }
         }
     }
-    catch (const Exception& e)
+    catch (const Exception&)
     {
-        SAL_WARN("dbaccess", "SbaGridControl::IsReadOnlyDB Exception occurred: " << e);
+        TOOLS_WARN_EXCEPTION("dbaccess", "SbaGridControl::IsReadOnlyDB Exception occurred");
     }
 
     return bDBIsReadOnly;
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 6bdb682f32d7..9c7f5ce9b62e 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -2387,7 +2387,9 @@ bool SbaTableQueryBrowser::implLoadAnything(const OUString& _rDataSourceName, co
         if  ( e.TargetException.isExtractableTo( ::cppu::UnoType< SQLException >::get() ) )
             showError( SQLExceptionInfo( e.TargetException ) );
         else
-            SAL_WARN("dbaccess", e);
+        {
+            TOOLS_WARN_EXCEPTION("dbaccess", "");
+        }
     }
     catch(const Exception&)
     {
commit 4466466a5c57a0d19ad8559ac699cf073f7e3e97
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jun 14 15:29:00 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jun 15 12:24:53 2019 +0200

    loplugin:logexceptionnicely in cui
    
    Change-Id: I0a3186b7f6d28725aff0e73d8f2cc4d5bc259a92
    Reviewed-on: https://gerrit.libreoffice.org/74044
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index fde5b58dd58b..b49e349ba245 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -628,9 +628,9 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
                     GetSaveInData()->PersistChanges(
                         GetSaveInData()->GetImageManager() );
                 }
-                catch ( css::uno::Exception& e)
+                catch ( const css::uno::Exception&)
                 {
-                    SAL_WARN("cui.customize", "Error replacing image: " << e);
+                    TOOLS_WARN_EXCEPTION("cui.customize", "Error replacing image");
                 }
             }
         }
@@ -672,9 +672,9 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
             GetSaveInData()->PersistChanges(
                 GetSaveInData()->GetImageManager() );
         }
-        catch ( css::uno::Exception& e )
+        catch ( const css::uno::Exception& )
         {
-            SAL_WARN("cui.customize", "Error resetting image: " << e);
+            TOOLS_WARN_EXCEPTION("cui.customize", "Error resetting image");
         }
     }
     else if (rIdent == "restoreItem")
@@ -724,9 +724,9 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const OString&, rIdent, void)
 
             bNeedsApply = true;
         }
-        catch ( css::uno::Exception& e )
+        catch ( const css::uno::Exception& )
         {
-            SAL_WARN("cui.customize", "Error restoring image: " << e);
+            TOOLS_WARN_EXCEPTION("cui.customize", "Error restoring image");
         }
     }
     else
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index d89aaa99acec..d9f3b6dca4c0 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -900,9 +900,9 @@ void ContextMenuSaveInData::Reset()
         {
             GetConfigManager()->removeSettings( pEntry->GetCommand() );
         }
-        catch ( const css::uno::Exception& e )
+        catch ( const css::uno::Exception& )
         {
-            SAL_WARN("cui.customize", "Exception caught while resetting context menus: " << e);
+            TOOLS_WARN_EXCEPTION("cui.customize", "Exception caught while resetting context menus");
         }
     }
     PersistChanges( GetConfigManager() );
@@ -915,9 +915,9 @@ void ContextMenuSaveInData::ResetContextMenu( const SvxConfigEntry* pEntry )
     {
         GetConfigManager()->removeSettings( pEntry->GetCommand() );
     }
-    catch ( const css::uno::Exception& e )
+    catch ( const css::uno::Exception& )
     {
-        SAL_WARN("cui.customize", "Exception caught while resetting context menu: " << e);
+        TOOLS_WARN_EXCEPTION("cui.customize", "Exception caught while resetting context menu");
     }
     PersistChanges( GetConfigManager() );
     m_pRootEntry.reset();
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index c081a5e83394..7a58aa96ab77 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -58,6 +58,7 @@
 #include <unotools/configmgr.hxx>
 #include <dialmgr.hxx>
 #include <svl/stritem.hxx>
+#include <tools/diagnose_ex.h>
 #include <vcl/commandinfoprovider.hxx>
 #include <vcl/help.hxx>
 #include <vcl/svapp.hxx>
@@ -649,9 +650,9 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
         Reference< browse::XBrowseNodeFactory > xFac = browse::theBrowseNodeFactory::get( m_xContext );
         rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) );
     }
-    catch( Exception& e )
+    catch( const Exception& )
     {
-        SAL_INFO("cui.customize", "Caught some exception whilst retrieving browse nodes from factory... Exception: " << e);
+        TOOLS_WARN_EXCEPTION("cui.customize", "Caught some exception whilst retrieving browse nodes from factory");
         // TODO exception handling
     }
 
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index 0141f908c38d..238156007a7e 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -21,6 +21,7 @@
 #include <sal/log.hxx>
 #include <vcl/svapp.hxx>
 
+#include <tools/diagnose_ex.h>
 #include <tools/debug.hxx>
 #include <tools/urlobj.hxx>
 #include <vcl/idle.hxx>
@@ -333,9 +334,9 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, ChangeSourceClickHdl, weld::Button&, void)
                 SetManager( pNewMgr );
             }
         }
-        catch (uno::Exception & e)
+        catch (const uno::Exception &)
         {
-            SAL_WARN("cui.dialogs", "SvBaseLinksDlg: " << e);
+            TOOLS_WARN_EXCEPTION("cui.dialogs", "SvBaseLinksDlg");
         }
     }
     else
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 75e89daf48ec..564dc5920466 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -150,9 +150,9 @@ void SvxScriptOrgDialog::Init( const OUString& language  )
             children = rootNode->getChildNodes();
         }
     }
-    catch( Exception& e )
+    catch( const Exception& )
     {
-        SAL_WARN("cui.dialogs", "Exception getting root browse node from factory: " << e );
+        TOOLS_WARN_EXCEPTION("cui.dialogs", "Exception getting root browse node from factory");
         // TODO exception handling
     }
 
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index 316639f29460..9e3406d07016 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -12,6 +12,7 @@
 #include <osl/security.hxx>
 #include <osl/thread.h>
 #include <sal/log.hxx>
+#include <tools/diagnose_ex.h>
 #include <unotools/securityoptions.hxx>
 #include "certpath.hxx"
 
@@ -91,9 +92,9 @@ CertPathDialog::CertPathDialog(weld::Window* pParent)
         if (!sUserSetCertPath.isEmpty())
             AddCertPath(m_sManual, sUserSetCertPath);
     }
-    catch (const uno::Exception &e)
+    catch (const uno::Exception &)
     {
-        SAL_WARN("cui.options", "CertPathDialog::CertPathDialog(): " << e);
+        TOOLS_WARN_EXCEPTION("cui.options", "CertPathDialog::CertPathDialog()");
     }
 
     const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER");
@@ -117,9 +118,9 @@ IMPL_LINK_NOARG(CertPathDialog, OKHdl_Impl, weld::Button&, void)
             getDirectory(), batch);
         batch->commit();
     }
-    catch (const uno::Exception &e)
+    catch (const uno::Exception &)
     {
-        SAL_WARN("cui.options", "CertPathDialog::OKHdl_Impl(): " << e);
+        TOOLS_WARN_EXCEPTION("cui.options", "CertPathDialog::OKHdl_Impl()");
     }
 
     m_xDialog->response(RET_OK);
@@ -200,9 +201,9 @@ IMPL_LINK_NOARG(CertPathDialog, AddHdl_Impl, weld::Button&, void)
                 AddCertPath(m_sManual, aPath);
         }
     }
-    catch (uno::Exception & e)
+    catch (const uno::Exception &)
     {
-        SAL_WARN("cui.options", e);
+        TOOLS_WARN_EXCEPTION("cui.options", "");
     }
 }
 
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index b7a02eff8287..b1d156aab5c7 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/util/SearchAlgorithms2.hpp>
 #include <unotools/textsearch.hxx>
 #include <sal/log.hxx>
+#include <tools/diagnose_ex.h>
 
 #include <memory>
 #include <vector>
@@ -264,9 +265,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
             xNextNameAccess.set(aNode, uno::UNO_QUERY);
             bNotLeaf = xNextNameAccess.is();
         }
-        catch (const RuntimeException& e)
+        catch (const RuntimeException&)
         {
-            SAL_WARN( "cui.options", "CuiAboutConfigTabPage: " << e);
+            TOOLS_WARN_EXCEPTION( "cui.options", "CuiAboutConfigTabPage");
         }
 
         if (bNotLeaf)
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 46bd0996cca1..1ff24bd88405 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -67,6 +67,7 @@
 #include <officecfg/Office/Common.hxx>
 #include <officecfg/Setup.hxx>
 #include <comphelper/configuration.hxx>
+#include <tools/diagnose_ex.h>
 
 #include <com/sun/star/configuration/theDefaultProvider.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
@@ -1218,11 +1219,11 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(vcl::Window* pParent, const SfxItemSet&
         }
 
     }
-    catch (const Exception &e)
+    catch (const Exception &)
     {
         // we'll just leave the box in its default setting and won't
         // even give it event handler...
-        SAL_WARN("cui.options", "ignoring " << e);
+        TOOLS_WARN_EXCEPTION("cui.options", "ignoring" );
     }
 
     m_pWesternLanguageLB->SetLanguageList( SvxLanguageListFlags::WESTERN | SvxLanguageListFlags::ONLY_KNOWN, true, true );
@@ -1398,11 +1399,11 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
             css::office::Quickstart::createAndSetVeto(xContext, false, false, false/*DisableVeto*/);
         }
     }
-    catch (const Exception& e)
+    catch (const Exception&)
     {
         // we'll just leave the box in its default setting and won't
         // even give it event handler...
-        SAL_WARN("cui.options", "ignoring Exception \"" << e << "\"");
+        TOOLS_WARN_EXCEPTION("cui.options", "ignoring");
     }
 
     LanguageTag aLanguageTag( pLangConfig->aSysLocaleOptions.GetLanguageTag());
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 9353b990e847..e4a16a298cf6 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -48,6 +48,7 @@
 #include <unotools/securityoptions.hxx>
 #include <unotools/extendedsecurityoptions.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
+#include <tools/diagnose_ex.h>
 
 #include <dialmgr.hxx>
 #include "optinet2.hxx"
@@ -825,9 +826,9 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MacroSecPBHdl, Button*, void)
         xD->setParentWindow(VCLUnoHelper::GetInterface(GetParentDialog()));
         xD->manageTrustedSources();
     }
-    catch (const Exception& e)
+    catch (const Exception&)
     {
-        SAL_WARN( "cui.options", e);
+        TOOLS_WARN_EXCEPTION( "cui.options", "");
     }
 }
 
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 4c2a9d1f2c8c..4383aed75f31 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -254,9 +254,9 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, AddHdl_Impl, Button*, void)
         else if ( xFolderPicker.is() && xFolderPicker->execute() == ExecutableDialogResults::OK )
             AddFolder( xFolderPicker->getDirectory() );
     }
-    catch (const Exception& e)
+    catch (const Exception&)
     {
-        SAL_WARN( "cui.options", "SvxJavaOptionsPage::AddHdl_Impl(): " << e);
+        TOOLS_WARN_EXCEPTION( "cui.options", "SvxJavaOptionsPage::AddHdl_Impl()");
     }
 }
 
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 4e53c34fdb3a..1543e1c964b9 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -816,9 +816,9 @@ void SvxPathTabPage::SetPathList(
         pImpl->m_xPathSettings->setPropertyValue(
             sCfgName + POSTFIX_WRITABLE, aValue);
     }
-    catch( const Exception& e )
+    catch( const Exception& )
     {
-        SAL_WARN("cui.options", "caught: " << e);
+        TOOLS_WARN_EXCEPTION("cui.options", "");
     }
 }
 
diff --git a/cui/source/options/tsaurls.cxx b/cui/source/options/tsaurls.cxx
index 7b91900d97bd..1cb21dab8eae 100644
--- a/cui/source/options/tsaurls.cxx
+++ b/cui/source/options/tsaurls.cxx
@@ -11,6 +11,7 @@
 #include <svx/svxdlg.hxx>
 #include <comphelper/sequence.hxx>
 #include <sal/log.hxx>
+#include <tools/diagnose_ex.h>
 #include <vcl/fixed.hxx>
 
 #include "tsaurls.hxx"
@@ -48,9 +49,9 @@ TSAURLsDialog::TSAURLsDialog(weld::Window* pParent)
             }
         }
     }
-    catch (const uno::Exception &e)
+    catch (const uno::Exception &)
     {
-        SAL_WARN("cui.options", "TSAURLsDialog::TSAURLsDialog(): " << e);
+        TOOLS_WARN_EXCEPTION("cui.options", "TSAURLsDialog::TSAURLsDialog()");
     }
 
     if (m_xURLListBox->get_selected_index() == -1)


More information about the Libreoffice-commits mailing list