[Libreoffice-commits] core.git: 2 commits - scripting/Library_protocolhandler.mk scripting/source sdext/source sd/source sfx2/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 17 06:19:44 UTC 2019


 scripting/Library_protocolhandler.mk                |    1 +
 scripting/source/protocolhandler/scripthandler.cxx  |   13 ++++++-------
 scripting/source/provider/BrowseNodeFactoryImpl.cxx |    4 ++--
 scripting/source/provider/MasterScriptProvider.cxx  |   10 +++++-----
 scripting/source/vbaevents/eventhelper.cxx          |    5 +++--
 sd/source/filter/xml/sdxmlwrp.cxx                   |    4 ++--
 sdext/source/pdfimport/filterdet.cxx                |    5 +++--
 sdext/source/pdfimport/pdfiadaptor.cxx              |    5 +++--
 sdext/source/pdfimport/test/pdf2xml.cxx             |    5 +++--
 sfx2/source/appl/appserv.cxx                        |   15 ++++++---------
 sfx2/source/bastyp/helper.cxx                       |    4 ++--
 sfx2/source/control/recentdocsview.cxx              |    8 ++++----
 sfx2/source/control/thumbnailview.cxx               |   20 ++++++++++----------
 sfx2/source/doc/SfxDocumentMetaData.cxx             |    5 +++--
 sfx2/source/doc/docfile.cxx                         |   16 ++++++++++------
 sfx2/source/doc/doctemplates.cxx                    |    5 ++---
 sfx2/source/doc/guisaveas.cxx                       |   14 +++++++-------
 sfx2/source/doc/objcont.cxx                         |    5 +++--
 sfx2/source/doc/objserv.cxx                         |    3 ++-
 sfx2/source/doc/objxtor.cxx                         |   16 ++++++++--------
 sfx2/source/sidebar/SidebarController.cxx           |    5 +++--
 sfx2/source/view/classificationhelper.cxx           |    9 +++++----
 sfx2/source/view/ipclient.cxx                       |   10 +++++-----
 sfx2/source/view/viewsh.cxx                         |    5 +++--
 24 files changed, 101 insertions(+), 91 deletions(-)

New commits:
commit 5aa942f3a5bf83e0426438913acc040abb6a329f
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun Jun 16 15:37:49 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jun 17 08:19:01 2019 +0200

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

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");
         }
     }
 }
commit f41a55474cb6217560af81ae99c3e2fe1aca5215
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun Jun 16 15:37:37 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jun 17 08:18:51 2019 +0200

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

diff --git a/scripting/Library_protocolhandler.mk b/scripting/Library_protocolhandler.mk
index e140bb322008..3d243f7f849b 100644
--- a/scripting/Library_protocolhandler.mk
+++ b/scripting/Library_protocolhandler.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_Library_use_libraries,protocolhandler,\
 	fwe \
 	sal \
 	sfx \
+	tl \
 	vcl \
 ))
 
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index 07c4353893d6..dff0f3513e4b 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -158,12 +158,11 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
                         {
                             xListener->dispatchFinished( aEvent ) ;
                         }
-                        catch(RuntimeException & e)
+                        catch(const RuntimeException &)
                         {
-                            SAL_WARN("scripting",
+                            TOOLS_WARN_EXCEPTION("scripting",
                                 "ScriptProtocolHandler::dispatchWithNotification: caught RuntimeException"
-                                "while dispatchFinished with failure of the execution "
-                                << e );
+                                "while dispatchFinished with failure of the execution");
                         }
                     }
                     return;
@@ -285,11 +284,11 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
         {
             xListener->dispatchFinished( aEvent ) ;
         }
-        catch(const RuntimeException & e)
+        catch(const RuntimeException &)
         {
-            SAL_WARN("scripting",
+            TOOLS_WARN_EXCEPTION("scripting",
                 "ScriptProtocolHandler::dispatchWithNotification: caught RuntimeException"
-                "while dispatchFinished " << e );
+                "while dispatchFinished" );
         }
     }
 }
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index d3fc898086b8..909443f5f511 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -282,9 +282,9 @@ std::vector< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Referen
         locnBNs[ mspIndex++ ].set( xFac->createScriptProvider( makeAny( OUString("share") ) ), UNO_QUERY_THROW );
     }
     // TODO proper exception handling, should throw
-    catch( const Exception& e )
+    catch( const Exception& )
     {
-        SAL_WARN("scripting", "Caught " << e );
+        TOOLS_WARN_EXCEPTION("scripting", "Caught" );
         locnBNs.resize( mspIndex );
         return locnBNs;
     }
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index 8daa183d5ec8..fe2d074c4632 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -209,10 +209,10 @@ void MasterScriptProvider::createPkgProvider()
             xFac->createScriptProvider( location ), UNO_SET_THROW );
 
     }
-    catch ( const Exception& e )
+    catch ( const Exception& )
     {
-        SAL_WARN("scripting.provider", "Exception creating MasterScriptProvider for uno_packages in context "
-                << m_sCtxString << ": " << e );
+        TOOLS_WARN_EXCEPTION("scripting.provider", "Exception creating MasterScriptProvider for uno_packages in context "
+                << m_sCtxString );
     }
 }
 
@@ -470,9 +470,9 @@ template <typename Proc> bool FindProviderAndApply(ProviderCache& rCache, Proc p
                 if (bResult)
                     break;
             }
-            catch (Exception& e)
+            catch (const Exception&)
             {
-                SAL_INFO("scripting.provider", "ignoring " << e);
+                TOOLS_INFO_EXCEPTION("scripting.provider", "ignoring");
             }
         }
         return bResult;
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index 21a52e9b28c4..8388450aa2b2 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -23,6 +23,7 @@
 #include <comphelper/uno3.hxx>
 #include <comphelper/proparrhlp.hxx>
 #include <comphelper/propertycontainer.hxx>
+#include <tools/diagnose_ex.h>
 
 #include <ooo/vba/XVBAToOOEventDescGen.hpp>
 
@@ -909,9 +910,9 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet )
                             ooo::vba::executeMacro( mpShell, url, aArguments, aRet, aDummyCaller );
                         }
                     }
-                    catch ( uno::Exception& e )
+                    catch ( const uno::Exception& )
                     {
-                        SAL_WARN("scripting", "event script raised " << e );
+                        TOOLS_WARN_EXCEPTION("scripting", "event script raised" );
                     }
                }
            }
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index 3c9cf80ab33b..e6e5adb26c4d 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -1005,9 +1005,9 @@ bool SdXMLFilter::Export()
                 mxStatusIndicator->end();
         }
     }
-    catch (const uno::Exception &e)
+    catch (const uno::Exception &)
     {
-        SAL_WARN( "sd.filter", "uno Exception caught while exporting:" << e);
+        TOOLS_WARN_EXCEPTION( "sd.filter", "uno Exception caught while exporting");
         bDocRet = false;
     }
     if ( !bLocked )
diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx
index a726ef883e3c..4b72c932f44c 100644
--- a/sdext/source/pdfimport/filterdet.cxx
+++ b/sdext/source/pdfimport/filterdet.cxx
@@ -36,6 +36,7 @@
 #include <comphelper/fileurl.hxx>
 #include <comphelper/hash.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <tools/diagnose_ex.h>
 #include <memory>
 #include <string.h>
 
@@ -290,8 +291,8 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF
                 }
                 osl_closeFile( aFile );
             }
-        } catch (css::io::IOException & e) {
-            SAL_WARN("sdext.pdfimport", "caught " << e);
+        } catch (const css::io::IOException &) {
+            TOOLS_WARN_EXCEPTION("sdext.pdfimport", "caught");
             return OUString();
         }
         OUString aEmbedMimetype;
diff --git a/sdext/source/pdfimport/pdfiadaptor.cxx b/sdext/source/pdfimport/pdfiadaptor.cxx
index cd8c67b24ab1..e66cf59f7f79 100644
--- a/sdext/source/pdfimport/pdfiadaptor.cxx
+++ b/sdext/source/pdfimport/pdfiadaptor.cxx
@@ -39,6 +39,7 @@
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/io/XSeekable.hpp>
+#include <tools/diagnose_ex.h>
 
 #include <memory>
 
@@ -153,9 +154,9 @@ sal_Bool SAL_CALL PDFIHybridAdaptor::filter( const uno::Sequence< beans::Propert
                         m_xContext ),
                     uno::UNO_QUERY );
             }
-            catch(const uno::Exception& e)
+            catch(const uno::Exception&)
             {
-                SAL_INFO("sdext.pdfimport", "subfilter: " << e);
+                TOOLS_INFO_EXCEPTION("sdext.pdfimport", "subfilter");
             }
 
             SAL_INFO("sdext.pdfimport", "subfilter: " << xSubFilter.get() );
diff --git a/sdext/source/pdfimport/test/pdf2xml.cxx b/sdext/source/pdfimport/test/pdf2xml.cxx
index 5d8c06ca0294..04b5ee8d19c0 100644
--- a/sdext/source/pdfimport/test/pdf2xml.cxx
+++ b/sdext/source/pdfimport/test/pdf2xml.cxx
@@ -32,6 +32,7 @@
 #include <unotest/bootstrapfixturebase.hxx>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/bootstrap.hxx>
+#include <tools/diagnose_ex.h>
 
 using namespace ::pdfi;
 using namespace ::com::sun::star;
@@ -80,9 +81,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         xAdaptor->setTreeVisitorFactory(pTreeFactory);
         nRet = xAdaptor->odfConvert(aSrcURL, new OutputWrap(aDstURL), nullptr) ? 0 : 1;
     }
-    catch (const uno::Exception& e)
+    catch (const uno::Exception&)
     {
-        SAL_WARN("vcl.app", "Fatal: " << e);
+        TOOLS_WARN_EXCEPTION("vcl.app", "Fatal");
         return 1;
     }
     catch (const std::exception& e)


More information about the Libreoffice-commits mailing list