Don't use Library_tl in URE libraries

This partly reverts 8b5e23eac3 "log nice exception
messages whereever possible", e1eb7cb04a
"loplugin:logexceptionnicely in starmath..svgio",
d6d80c4e17 "OSL_FAIL.*exception ->
TOOLS_WARN_EXCEPTION", and 877f40ac3f "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 <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2022-02-24 14:31:23 +01:00
parent ea25606de5
commit 9c431f4d3a
12 changed files with 47 additions and 48 deletions

View file

@ -46,6 +46,12 @@ public:
return false; return false;
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/comphelper/")) if (loplugin::hasPathnamePrefix(fn, SRCDIR "/comphelper/"))
return false; 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 // can't do that here, don't have an Any
if (loplugin::hasPathnamePrefix(fn, SRCDIR if (loplugin::hasPathnamePrefix(fn, SRCDIR
"/connectivity/source/drivers/hsqldb/HStorageMap.cxx")) "/connectivity/source/drivers/hsqldb/HStorageMap.cxx"))

View file

@ -18,7 +18,6 @@ $(eval $(call gb_Library_use_libraries,io,\
cppu \ cppu \
cppuhelper \ cppuhelper \
sal \ sal \
tl \
)) ))
$(eval $(call gb_Library_set_componentfile,io,io/source/io,ure/services)) $(eval $(call gb_Library_set_componentfile,io,io/source/io,ure/services))

View file

@ -18,6 +18,8 @@
*/ */
#include <sal/log.hxx>
#include <com/sun/star/io/IOException.hpp> #include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/io/NotConnectedException.hpp> #include <com/sun/star/io/NotConnectedException.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XActiveDataSource.hpp>
@ -32,7 +34,7 @@
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <osl/thread.h> #include <osl/thread.h>
#include <tools/diagnose_ex.h>
using namespace osl; using namespace osl;
using namespace cppu; using namespace cppu;
@ -123,9 +125,9 @@ void Pump::fireError( const Any & exception )
{ {
static_cast< XStreamListener * > ( iter.next() )->error( 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( ); 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( ); 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(); 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(); close();
fireClose(); fireClose();
} }
catch ( const css::uno::Exception & ) catch ( const css::uno::Exception &e )
{ {
// we are the last on the stack. // we are the last on the stack.
// this is to avoid crashing the program, when e.g. a bridge crashes // 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);
} }
} }

View file

@ -19,7 +19,6 @@ $(eval $(call gb_Library_use_libraries,juhx,\
jvmaccess \ jvmaccess \
sal \ sal \
salhelper \ salhelper \
tl \
)) ))
$(eval $(call gb_Library_add_exception_objects,juhx,\ $(eval $(call gb_Library_add_exception_objects,juhx,\

View file

@ -44,7 +44,6 @@
#endif #endif
#include <jvmaccess/unovirtualmachine.hxx> #include <jvmaccess/unovirtualmachine.hxx>
#include <tools/diagnose_ex.h>
#include "juhx-export-functions.hxx" #include "juhx-export-functions.hxx"
#include "vm.hxx" #include "vm.hxx"
@ -156,11 +155,10 @@ jobject Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap(
} }
catch (const RuntimeException & exc) catch (const RuntimeException & exc)
{ {
css::uno::Any exAny( cppu::getCaughtException() );
jclass c = jni_env->FindClass( "com/sun/star/uno/RuntimeException" ); jclass c = jni_env->FindClass( "com/sun/star/uno/RuntimeException" );
if (nullptr != c) if (nullptr != c)
{ {
SAL_WARN("javaunohelper", "forwarding RuntimeException: " << exceptionToString(exAny) ); SAL_WARN("javaunohelper", "forwarding RuntimeException: " << exc );
OString cstr( OUStringToOString( OString cstr( OUStringToOString(
exc.Message, RTL_TEXTENCODING_JAVA_UTF8 ) ); exc.Message, RTL_TEXTENCODING_JAVA_UTF8 ) );
jni_env->ThrowNew( c, cstr.getStr() ); jni_env->ThrowNew( c, cstr.getStr() );
@ -168,11 +166,10 @@ jobject Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap(
} }
catch (const Exception & exc) catch (const Exception & exc)
{ {
css::uno::Any ex( cppu::getCaughtException() );
jclass c = jni_env->FindClass( "com/sun/star/uno/Exception" ); jclass c = jni_env->FindClass( "com/sun/star/uno/Exception" );
if (nullptr != c) if (nullptr != c)
{ {
SAL_WARN("javaunohelper", "forwarding Exception: " << exceptionToString(ex) ); SAL_WARN("javaunohelper", "forwarding Exception: " << exc );
OString cstr( OUStringToOString( OString cstr( OUStringToOString(
exc.Message, RTL_TEXTENCODING_JAVA_UTF8 ) ); exc.Message, RTL_TEXTENCODING_JAVA_UTF8 ) );
jni_env->ThrowNew( c, cstr.getStr() ); jni_env->ThrowNew( c, cstr.getStr() );

View file

@ -32,7 +32,6 @@ $(eval $(call gb_Library_use_libraries,bootstrap,\
reg \ reg \
sal \ sal \
salhelper \ salhelper \
tl \
)) ))
$(eval $(call gb_Library_set_componentfile,bootstrap,stoc/util/bootstrap,ure/services)) $(eval $(call gb_Library_set_componentfile,bootstrap,stoc/util/bootstrap,ure/services))

View file

@ -19,7 +19,6 @@ $(eval $(call gb_Library_use_libraries,javaloader,\
jvmaccess \ jvmaccess \
sal \ sal \
salhelper \ salhelper \
tl \
)) ))
$(eval $(call gb_Library_set_componentfile,javaloader,stoc/source/javaloader/javaloader,ure/services)) $(eval $(call gb_Library_set_componentfile,javaloader,stoc/source/javaloader/javaloader,ure/services))

View file

@ -21,7 +21,6 @@ $(eval $(call gb_Library_use_libraries,javavm,\
jvmfwk \ jvmfwk \
sal \ sal \
salhelper \ salhelper \
tl \
)) ))
$(eval $(call gb_Library_set_componentfile,javavm,stoc/source/javavm/javavm,ure/services)) $(eval $(call gb_Library_set_componentfile,javavm,stoc/source/javavm/javavm,ure/services))

View file

@ -27,7 +27,6 @@
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequence.hxx> #include <comphelper/sequence.hxx>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <tools/diagnose_ex.h>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XServiceInfo.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 // no way to transport the error, as no exception is specified and a runtime
// exception is not appropriate. // exception is not appropriate.
TOOLS_WARN_EXCEPTION( "stoc", "InvalidRegistryException during revokeImplementation" ); OSL_FAIL( "InvalidRegistryException during revokeImplementation" );
} }
} }

View file

@ -26,7 +26,6 @@
#include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/exc_hlp.hxx>
#include <tools/diagnose_ex.h>
#ifdef LINUX #ifdef LINUX
#undef minor #undef minor
@ -335,8 +334,10 @@ stoc_JavaComponentLoader_get_implementation(
try { try {
return cppu::acquire(new JavaComponentLoader(context)); return cppu::acquire(new JavaComponentLoader(context));
} }
catch(const RuntimeException &) { catch(const RuntimeException & runtimeException) {
TOOLS_INFO_EXCEPTION("stoc", "could not init javaloader"); SAL_INFO(
"stoc",
"could not init javaloader due to " << runtimeException);
throw; throw;
} }
} }

View file

@ -57,7 +57,7 @@
#include <rtl/process.h> #include <rtl/process.h>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <sal/types.h> #include <sal/types.h>
#include <tools/diagnose_ex.h> #include <sal/log.hxx>
#include <uno/current_context.hxx> #include <uno/current_context.hxx>
#include <jvmfwk/framework.hxx> #include <jvmfwk/framework.hxx>
#include <i18nlangtag/languagetag.hxx> #include <i18nlangtag/languagetag.hxx>
@ -419,23 +419,23 @@ void initVMConfiguration(
try { try {
getINetPropsFromConfig(&jvm, xSMgr, xCtx); getINetPropsFromConfig(&jvm, xSMgr, xCtx);
} }
catch(const css::uno::Exception &) { catch(const css::uno::Exception & exception) {
TOOLS_INFO_EXCEPTION("stoc", "can not get INETProps"); SAL_INFO("stoc", "can not get INETProps because of " << exception);
} }
try { try {
getDefaultLocaleFromConfig(&jvm, xSMgr,xCtx); getDefaultLocaleFromConfig(&jvm, xSMgr,xCtx);
} }
catch(const css::uno::Exception &) { catch(const css::uno::Exception & exception) {
TOOLS_INFO_EXCEPTION("stoc", "can not get locale"); SAL_INFO("stoc", "can not get locale because of " << exception);
} }
try try
{ {
getJavaPropsFromSafetySettings(&jvm, xSMgr, xCtx); getJavaPropsFromSafetySettings(&jvm, xSMgr, xCtx);
} }
catch(const css::uno::Exception &) { catch(const css::uno::Exception & exception) {
TOOLS_INFO_EXCEPTION("stoc", "couldn't get safety settings"); SAL_INFO("stoc", "couldn't get safety settings because of " << exception);
} }
*pjvm= jvm; *pjvm= jvm;
@ -1129,7 +1129,7 @@ JavaVirtualMachine::~JavaVirtualMachine()
} }
catch (css::uno::Exception &) catch (css::uno::Exception &)
{ {
TOOLS_WARN_EXCEPTION( "stoc", ""); OSL_FAIL("com.sun.star.uno.Exception caught");
} }
if (m_xJavaConfiguration.is()) if (m_xJavaConfiguration.is())
// We should never get here, but just in case... // We should never get here, but just in case...
@ -1139,7 +1139,7 @@ JavaVirtualMachine::~JavaVirtualMachine()
} }
catch (css::uno::Exception &) 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()) if (m_xJavaConfiguration.is())
m_xJavaConfiguration->addContainerListener(this); 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 &) catch (css::uno::RuntimeException &)
{ {
TOOLS_WARN_EXCEPTION( "stoc", ""); OSL_FAIL("RuntimeException");
} }
catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &)
{ {
TOOLS_WARN_EXCEPTION( "stoc", ""); OSL_FAIL("jvmaccess::VirtualMachine::AttachGuard::CreationException");
} }
} }

View file

@ -23,7 +23,6 @@
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <sal/log.hxx> #include <sal/log.hxx>
#include <tools/diagnose_ex.h>
#include <cppuhelper/basemutex.hxx> #include <cppuhelper/basemutex.hxx>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
@ -289,11 +288,11 @@ void OServiceManager_Listener::disposing(const EventObject & rEvt )
} }
catch( const IllegalArgumentException & ) catch( const IllegalArgumentException & )
{ {
TOOLS_WARN_EXCEPTION( "stoc", "" ); OSL_FAIL( "IllegalArgumentException caught" );
} }
catch( const NoSuchElementException & ) catch( const NoSuchElementException & )
{ {
TOOLS_WARN_EXCEPTION( "stoc", "" ); OSL_FAIL( "NoSuchElementException caught" );
} }
} }
@ -608,9 +607,9 @@ void OServiceManager::disposing()
if( xComp.is() ) if( xComp.is() )
xComp->dispose(); 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);
} }
} }