compilerplugins/clang/logexceptionnicely.cxx       |    6 ++++
 io/Library_io.mk                                   |    1 
 io/source/stm/opump.cxx                            |   24 ++++++++++---------
 javaunohelper/Library_juhx.mk                      |    1 
 javaunohelper/source/bootstrap.cxx                 |    7 +----
 stoc/Library_bootstrap.mk                          |    1 
 stoc/Library_javaloader.mk                         |    1 
 stoc/Library_javavm.mk                             |    1 
 stoc/source/implementationregistration/implreg.cxx |    3 --
 stoc/source/javaloader/javaloader.cxx              |    7 +++--
 stoc/source/javavm/javavm.cxx                      |   26 ++++++++++-----------
 stoc/source/servicemanager/servicemanager.cxx      |   17 ++++++-------
 12 files changed, 47 insertions(+), 48 deletions(-)

New commits:
commit 9c431f4d3afed0aad21b5ba67a5a55328c4d0685
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Feb 24 14:31:23 2022 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Fri Feb 25 08:20:55 2022 +0100

    Don't use Library_tl in URE libraries
    
    This partly reverts 8b5e23eac31cafbd442a3acab5fbcf98bfd0af11 "log nice 
exception
    messages whereever possible", e1eb7cb04a4c30cec238ab0f54d41a6cdc3299c1
    "loplugin:logexceptionnicely in starmath..svgio",
    d6d80c4e1783b4459bd4a8fbcbdfeebe416c1cb5 "OSL_FAIL.*exception ->
    TOOLS_WARN_EXCEPTION", and 877f40ac3f2add2b6dc37bae280d4d98dd102286 
"tdf#42949
    Fix new IWYU warnings in directories [h-r]*", and adapts
    loplugin:logexceptionnicely accordingly.
    
    Change-Id: I792b853b988c7c5f77179ca0672c30cb4223b5a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130502
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/compilerplugins/clang/logexceptionnicely.cxx 
b/compilerplugins/clang/logexceptionnicely.cxx
index b010b132dfa8..6cc66fdf0289 100644
--- a/compilerplugins/clang/logexceptionnicely.cxx
+++ b/compilerplugins/clang/logexceptionnicely.cxx
@@ -46,6 +46,12 @@ public:
             return false;
         if (loplugin::hasPathnamePrefix(fn, SRCDIR "/comphelper/"))
             return false;
+        if (loplugin::hasPathnamePrefix(fn, SRCDIR "/io/"))
+            return false;
+        if (loplugin::hasPathnamePrefix(fn, SRCDIR "/javaunohelper/"))
+            return false;
+        if (loplugin::hasPathnamePrefix(fn, SRCDIR "/stoc/"))
+            return false;
         // can't do that here, don't have an Any
         if (loplugin::hasPathnamePrefix(fn, SRCDIR
                                         
"/connectivity/source/drivers/hsqldb/HStorageMap.cxx"))
diff --git a/io/Library_io.mk b/io/Library_io.mk
index a22a522f7bbc..6c70822eece1 100644
--- a/io/Library_io.mk
+++ b/io/Library_io.mk
@@ -18,7 +18,6 @@ $(eval $(call gb_Library_use_libraries,io,\
     cppu \
     cppuhelper \
     sal \
-    tl \
 ))
 
 $(eval $(call gb_Library_set_componentfile,io,io/source/io,ure/services))
diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx
index c6cb22cb4816..97f254b6be2a 100644
--- a/io/source/stm/opump.cxx
+++ b/io/source/stm/opump.cxx
@@ -18,6 +18,8 @@
  */
 
 
+#include <sal/log.hxx>
+
 #include <com/sun/star/io/IOException.hpp>
 #include <com/sun/star/io/NotConnectedException.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
@@ -32,7 +34,7 @@
 #include <cppuhelper/supportsservice.hxx>
 #include <osl/mutex.hxx>
 #include <osl/thread.h>
-#include <tools/diagnose_ex.h>
+
 
 using namespace osl;
 using namespace cppu;
@@ -123,9 +125,9 @@ void Pump::fireError( const  Any & exception )
         {
             static_cast< XStreamListener * > ( iter.next() )->error( exception 
);
         }
-        catch ( const RuntimeException & )
+        catch ( const RuntimeException &e )
         {
-            TOOLS_WARN_EXCEPTION("io.streams","com.sun.star.comp.stoc.Pump: 
unexpected exception during calling listeners");
+            SAL_WARN("io.streams","com.sun.star.comp.stoc.Pump: unexpected 
exception during calling listeners" << e);
         }
     }
 }
@@ -152,9 +154,9 @@ void Pump::fireClose()
         {
             static_cast< XStreamListener * > ( iter.next() )->closed( );
         }
-        catch ( const RuntimeException & )
+        catch ( const RuntimeException &e )
         {
-            TOOLS_WARN_EXCEPTION("io.streams","com.sun.star.comp.stoc.Pump: 
unexpected exception during calling listeners");
+            SAL_WARN("io.streams","com.sun.star.comp.stoc.Pump: unexpected 
exception during calling listeners" << e);
         }
     }
 }
@@ -168,9 +170,9 @@ void Pump::fireStarted()
         {
             static_cast< XStreamListener * > ( iter.next() )->started( );
         }
-        catch ( const RuntimeException & )
+        catch ( const RuntimeException &e )
         {
-            TOOLS_WARN_EXCEPTION("io.streams","com.sun.star.comp.stoc.Pump: 
unexpected exception during calling listeners");
+            SAL_WARN("io.streams","com.sun.star.comp.stoc.Pump: unexpected 
exception during calling listeners" << e);
         }
     }
 }
@@ -184,9 +186,9 @@ void Pump::fireTerminated()
         {
             static_cast< XStreamListener * > ( iter.next() )->terminated();
         }
-        catch ( const RuntimeException & )
+        catch ( const RuntimeException &e )
         {
-            TOOLS_WARN_EXCEPTION("io.streams","com.sun.star.comp.stoc.Pump: 
unexpected exception during calling listeners");
+            SAL_WARN("io.streams","com.sun.star.comp.stoc.Pump: unexpected 
exception during calling listeners" << e);
         }
     }
 }
@@ -284,11 +286,11 @@ void Pump::run()
         close();
         fireClose();
     }
-    catch ( const css::uno::Exception & )
+    catch ( const css::uno::Exception &e )
     {
         // we are the last on the stack.
         // this is to avoid crashing the program, when e.g. a bridge crashes
-        TOOLS_WARN_EXCEPTION("io.streams","com.sun.star.comp.stoc.Pump: 
unexpected exception during calling listeners");
+        SAL_WARN("io.streams","com.sun.star.comp.stoc.Pump: unexpected 
exception during calling listeners" << e);
     }
 }
 
diff --git a/javaunohelper/Library_juhx.mk b/javaunohelper/Library_juhx.mk
index 6eacff250c0f..1a24e5ef54f2 100644
--- a/javaunohelper/Library_juhx.mk
+++ b/javaunohelper/Library_juhx.mk
@@ -19,7 +19,6 @@ $(eval $(call gb_Library_use_libraries,juhx,\
     jvmaccess \
     sal \
     salhelper \
-    tl \
 ))
 
 $(eval $(call gb_Library_add_exception_objects,juhx,\
diff --git a/javaunohelper/source/bootstrap.cxx 
b/javaunohelper/source/bootstrap.cxx
index cec9d500ba9c..1cacea950c0d 100644
--- a/javaunohelper/source/bootstrap.cxx
+++ b/javaunohelper/source/bootstrap.cxx
@@ -44,7 +44,6 @@
 #endif
 
 #include <jvmaccess/unovirtualmachine.hxx>
-#include <tools/diagnose_ex.h>
 
 #include "juhx-export-functions.hxx"
 #include "vm.hxx"
@@ -156,11 +155,10 @@ jobject 
Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap(
     }
     catch (const RuntimeException & exc)
     {
-        css::uno::Any exAny( cppu::getCaughtException() );
         jclass c = jni_env->FindClass( "com/sun/star/uno/RuntimeException" );
         if (nullptr != c)
         {
-            SAL_WARN("javaunohelper", "forwarding RuntimeException: " << 
exceptionToString(exAny) );
+            SAL_WARN("javaunohelper", "forwarding RuntimeException: " << exc );
             OString cstr( OUStringToOString(
                               exc.Message, RTL_TEXTENCODING_JAVA_UTF8 ) );
             jni_env->ThrowNew( c, cstr.getStr() );
@@ -168,11 +166,10 @@ jobject 
Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap(
     }
     catch (const Exception & exc)
     {
-        css::uno::Any ex( cppu::getCaughtException() );
         jclass c = jni_env->FindClass( "com/sun/star/uno/Exception" );
         if (nullptr != c)
         {
-            SAL_WARN("javaunohelper",  "forwarding Exception: " << 
exceptionToString(ex) );
+            SAL_WARN("javaunohelper",  "forwarding Exception: " << exc );
             OString cstr( OUStringToOString(
                               exc.Message, RTL_TEXTENCODING_JAVA_UTF8 ) );
             jni_env->ThrowNew( c, cstr.getStr() );
diff --git a/stoc/Library_bootstrap.mk b/stoc/Library_bootstrap.mk
index f7a308590184..ca1f49618bb8 100644
--- a/stoc/Library_bootstrap.mk
+++ b/stoc/Library_bootstrap.mk
@@ -32,7 +32,6 @@ $(eval $(call gb_Library_use_libraries,bootstrap,\
     reg \
     sal \
     salhelper \
-    tl \
 ))
 
 $(eval $(call 
gb_Library_set_componentfile,bootstrap,stoc/util/bootstrap,ure/services))
diff --git a/stoc/Library_javaloader.mk b/stoc/Library_javaloader.mk
index 5b13b39c29eb..2fd3a491f872 100644
--- a/stoc/Library_javaloader.mk
+++ b/stoc/Library_javaloader.mk
@@ -19,7 +19,6 @@ $(eval $(call gb_Library_use_libraries,javaloader,\
     jvmaccess \
     sal \
     salhelper \
-    tl \
 ))
 
 $(eval $(call 
gb_Library_set_componentfile,javaloader,stoc/source/javaloader/javaloader,ure/services))
diff --git a/stoc/Library_javavm.mk b/stoc/Library_javavm.mk
index b281e8aa247c..e096565769f9 100644
--- a/stoc/Library_javavm.mk
+++ b/stoc/Library_javavm.mk
@@ -21,7 +21,6 @@ $(eval $(call gb_Library_use_libraries,javavm,\
     jvmfwk \
     sal \
     salhelper \
-    tl \
 ))
 
 $(eval $(call 
gb_Library_set_componentfile,javavm,stoc/source/javavm/javavm,ure/services))
diff --git a/stoc/source/implementationregistration/implreg.cxx 
b/stoc/source/implementationregistration/implreg.cxx
index d0d57055b59d..7d697e41f372 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -27,7 +27,6 @@
 #include <cppuhelper/supportsservice.hxx>
 #include <comphelper/sequence.hxx>
 #include <rtl/ustring.hxx>
-#include <tools/diagnose_ex.h>
 
 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -1367,7 +1366,7 @@ sal_Bool 
ImplementationRegistration::revokeImplementation(const OUString& locati
         {
             // no way to transport the error, as no exception is specified and 
a runtime
             // exception is not appropriate.
-            TOOLS_WARN_EXCEPTION( "stoc", "InvalidRegistryException during 
revokeImplementation" );
+            OSL_FAIL( "InvalidRegistryException during revokeImplementation" );
         }
     }
 
diff --git a/stoc/source/javaloader/javaloader.cxx 
b/stoc/source/javaloader/javaloader.cxx
index dfb281ae99fb..be8e1c2a01ba 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -26,7 +26,6 @@
 #include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
 #include <cppuhelper/exc_hlp.hxx>
-#include <tools/diagnose_ex.h>
 
 #ifdef LINUX
 #undef minor
@@ -335,8 +334,10 @@ stoc_JavaComponentLoader_get_implementation(
     try {
         return cppu::acquire(new JavaComponentLoader(context));
     }
-    catch(const RuntimeException &) {
-        TOOLS_INFO_EXCEPTION("stoc", "could not init javaloader");
+    catch(const RuntimeException & runtimeException) {
+        SAL_INFO(
+            "stoc",
+            "could not init javaloader due to " << runtimeException);
         throw;
     }
 }
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 00fec7970aa6..7f0018350689 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -57,7 +57,7 @@
 #include <rtl/process.h>
 #include <rtl/ustring.hxx>
 #include <sal/types.h>
-#include <tools/diagnose_ex.h>
+#include <sal/log.hxx>
 #include <uno/current_context.hxx>
 #include <jvmfwk/framework.hxx>
 #include <i18nlangtag/languagetag.hxx>
@@ -419,23 +419,23 @@ void initVMConfiguration(
     try {
         getINetPropsFromConfig(&jvm, xSMgr, xCtx);
     }
-    catch(const css::uno::Exception &) {
-        TOOLS_INFO_EXCEPTION("stoc", "can not get INETProps");
+    catch(const css::uno::Exception & exception) {
+        SAL_INFO("stoc", "can not get INETProps because of " << exception);
     }
 
     try {
         getDefaultLocaleFromConfig(&jvm, xSMgr,xCtx);
     }
-    catch(const css::uno::Exception &) {
-        TOOLS_INFO_EXCEPTION("stoc", "can not get locale");
+    catch(const css::uno::Exception & exception) {
+        SAL_INFO("stoc", "can not get locale because of " << exception);
     }
 
     try
     {
         getJavaPropsFromSafetySettings(&jvm, xSMgr, xCtx);
     }
-    catch(const css::uno::Exception &) {
-        TOOLS_INFO_EXCEPTION("stoc", "couldn't get safety settings");
+    catch(const css::uno::Exception & exception) {
+        SAL_INFO("stoc", "couldn't get safety settings because of " << 
exception);
     }
 
     *pjvm= jvm;
@@ -1129,7 +1129,7 @@ JavaVirtualMachine::~JavaVirtualMachine()
         }
         catch (css::uno::Exception &)
         {
-            TOOLS_WARN_EXCEPTION( "stoc", "");
+            OSL_FAIL("com.sun.star.uno.Exception caught");
         }
     if (m_xJavaConfiguration.is())
         // We should never get here, but just in case...
@@ -1139,7 +1139,7 @@ JavaVirtualMachine::~JavaVirtualMachine()
         }
         catch (css::uno::Exception &)
         {
-            TOOLS_WARN_EXCEPTION( "stoc", "");
+            OSL_FAIL("com.sun.star.uno.Exception caught");
         }
 }
 
@@ -1209,9 +1209,9 @@ void JavaVirtualMachine::registerConfigChangesListener()
             if (m_xJavaConfiguration.is())
                 m_xJavaConfiguration->addContainerListener(this);
         }
-    }catch(const css::uno::Exception &)
+    }catch(const css::uno::Exception & e)
     {
-        TOOLS_INFO_EXCEPTION("stoc", "could not set up listener for 
Configuration");
+        SAL_INFO("stoc", "could not set up listener for Configuration because 
of >" << e << "<");
     }
 }
 
@@ -1338,11 +1338,11 @@ void JavaVirtualMachine::setINetSettingsInVM(bool 
set_reset)
     }
     catch (css::uno::RuntimeException &)
     {
-        TOOLS_WARN_EXCEPTION( "stoc", "");
+        OSL_FAIL("RuntimeException");
     }
     catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &)
     {
-        TOOLS_WARN_EXCEPTION( "stoc", "");
+        OSL_FAIL("jvmaccess::VirtualMachine::AttachGuard::CreationException");
     }
 }
 
diff --git a/stoc/source/servicemanager/servicemanager.cxx 
b/stoc/source/servicemanager/servicemanager.cxx
index ddaee87576d8..abda0b4dad36 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -23,7 +23,6 @@
 #include <osl/mutex.hxx>
 #include <osl/diagnose.h>
 #include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
 
 #include <cppuhelper/basemutex.hxx>
 #include <cppuhelper/factory.hxx>
@@ -289,11 +288,11 @@ void OServiceManager_Listener::disposing(const 
EventObject & rEvt )
     }
     catch( const IllegalArgumentException & )
     {
-        TOOLS_WARN_EXCEPTION( "stoc", "" );
+        OSL_FAIL( "IllegalArgumentException caught" );
     }
     catch( const NoSuchElementException & )
     {
-        TOOLS_WARN_EXCEPTION( "stoc", "" );
+        OSL_FAIL( "NoSuchElementException caught" );
     }
 }
 
@@ -608,9 +607,9 @@ void OServiceManager::disposing()
             if( xComp.is() )
                 xComp->dispose();
         }
-        catch (const RuntimeException &)
+        catch (const RuntimeException & exc)
         {
-            TOOLS_INFO_EXCEPTION("stoc", "RuntimeException occurred upon 
disposing factory:");
+            SAL_INFO("stoc", "RuntimeException occurred upon disposing 
factory: " << exc);
         }
     }
 
@@ -793,9 +792,9 @@ Reference< XInterface > 
OServiceManager::createInstanceWithContext(
                 }
             }
         }
-        catch (const lang::DisposedException &)
+        catch (const lang::DisposedException & exc)
         {
-            TOOLS_INFO_EXCEPTION("stoc", "");
+            SAL_INFO("stoc", "DisposedException occurred: " << exc);
         }
     }
 
@@ -845,9 +844,9 @@ Reference< XInterface > 
OServiceManager::createInstanceWithArgumentsAndContext(
                 }
             }
         }
-        catch (const lang::DisposedException &)
+        catch (const lang::DisposedException & exc)
         {
-            TOOLS_INFO_EXCEPTION("stoc", "DisposedException occurred:");
+            SAL_INFO("stoc", "DisposedException occurred: " << exc);
         }
     }
 

Reply via email to