loplugin:logexceptionnicely in configmgr..connectivity

Change-Id: I1cf8250dba63b744f882e54e9eb572884f292975
Reviewed-on: https://gerrit.libreoffice.org/74020
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2019-06-14 09:32:27 +02:00
parent bba7ca803c
commit 48b9951779
9 changed files with 33 additions and 29 deletions

View file

@ -32,6 +32,7 @@ $(eval $(call gb_CppunitTest_use_libraries,configmgr_unit, \
sal \
salhelper \
test \
tl \
unotest \
xmlreader \
i18nlangtag \

View file

@ -60,6 +60,7 @@ $(eval $(call gb_Library_use_libraries,configmgr, \
cppuhelper \
sal \
salhelper \
tl \
xmlreader \
i18nlangtag \
))

View file

@ -51,6 +51,7 @@
#include <sal/log.hxx>
#include <sal/types.h>
#include <salhelper/thread.hxx>
#include <tools/diagnose_ex.h>
#include <comphelper/backupfilehelper.hxx>
#include "additions.hxx"
@ -184,9 +185,9 @@ void Components::WriteThread::execute() {
try {
try {
writeModFile(components_, url_, data_);
} catch (css::uno::RuntimeException & e) {
} catch (css::uno::RuntimeException &) {
// Ignore write errors, instead of aborting:
SAL_WARN("configmgr", "error writing modifications: " << e);
TOOLS_WARN_EXCEPTION("configmgr", "error writing modifications");
}
} catch (...) {
reference_->clear();
@ -395,10 +396,10 @@ void Components::insertModificationXcuFile(
try {
parseFileLeniently(
&parseXcuFile, fileUri, Data::NO_LAYER, &part, modifications, nullptr);
} catch (css::container::NoSuchElementException & e) {
SAL_WARN(
} catch (const css::container::NoSuchElementException &) {
TOOLS_WARN_EXCEPTION(
"configmgr",
"error inserting non-existing \"" << fileUri << "\": " << e);
"error inserting non-existing \"" << fileUri << "\"");
}
}
@ -418,15 +419,15 @@ css::beans::Optional< css::uno::Any > Components::getExternalValue(
try {
service = context_->getServiceManager()->createInstanceWithContext(
name, context_);
} catch (css::uno::RuntimeException &) {
} catch (const css::uno::RuntimeException &) {
// Assuming these exceptions are real errors:
throw;
} catch (css::uno::Exception & e) {
} catch (const css::uno::Exception &) {
// Assuming these exceptions indicate that the service is not
// installed:
SAL_WARN(
TOOLS_WARN_EXCEPTION(
"configmgr",
"createInstance(" << name << ") failed with " << e);
"createInstance(" << name << ") failed");
}
css::uno::Reference< css::beans::XPropertySet > propset;
if (service.is()) {
@ -650,14 +651,14 @@ void Components::parseFileLeniently(
assert(parseFile != nullptr);
try {
(*parseFile)(url, layer, data_, partial, modifications, additions);
} catch (css::container::NoSuchElementException &) {
} catch (const css::container::NoSuchElementException &) {
throw;
} catch (css::uno::Exception & e) { //TODO: more specific exception catching
} catch (const css::uno::Exception &) { //TODO: more specific exception catching
// Ignore invalid XML files, instead of completely preventing OOo from
// starting:
SAL_WARN(
TOOLS_WARN_EXCEPTION(
"configmgr",
"error reading \"" << url << "\": " << e);
"error reading \"" << url << "\"");
}
}
@ -729,8 +730,8 @@ void Components::parseFileList(
}
try {
parseFileLeniently(parseFile, url, layer, nullptr, nullptr, adds);
} catch (css::container::NoSuchElementException & e) {
SAL_WARN("configmgr", "file does not exist: " << e);
} catch (const css::container::NoSuchElementException &) {
TOOLS_WARN_EXCEPTION("configmgr", "file does not exist");
if (adds != nullptr) {
data_.removeExtensionXcuAdditions(url);
}

View file

@ -34,6 +34,7 @@ $(eval $(call gb_Library_use_libraries,firebird_sdbc, \
salhelper \
utl \
svt \
tl \
vcl \
))

View file

@ -961,10 +961,10 @@ try
{
xNewProps->setPropertyValue(pResult->Name, xOldProps->getPropertyValue(pResult->Name));
}
catch(IllegalArgumentException const & exc)
catch(IllegalArgumentException const &)
{
SAL_WARN( "connectivity.commontools", "TransferFormComponentProperties : could not transfer the value for property \""
<< pResult->Name << "\" " << exc);
TOOLS_WARN_EXCEPTION( "connectivity.commontools", "TransferFormComponentProperties : could not transfer the value for property \""
<< pResult->Name << "\"");
}
}
}

View file

@ -382,9 +382,9 @@ Any OPoolCollection::getNodeValue(const OUString& _rPath,const Reference<XInterf
aReturn = xHierarchyAccess->getByHierarchicalName(_rPath);
}
}
catch(NoSuchElementException& e)
catch(const NoSuchElementException&)
{
SAL_WARN("connectivity.cpool", e );
TOOLS_WARN_EXCEPTION("connectivity.cpool", "" );
}
return aReturn;
}

View file

@ -19,6 +19,7 @@
#include <connectivity/dbexception.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <sal/log.hxx>
#include <tools/diagnose_ex.h>
using namespace ::connectivity::firebird;
@ -175,10 +176,10 @@ void SAL_CALL Blob::disposing()
{
closeBlob();
}
catch (SQLException &e)
catch (const SQLException &)
{
// we cannot throw any exceptions here...
SAL_WARN("connectivity.firebird", "isc_close_blob failed " << e);
TOOLS_WARN_EXCEPTION("connectivity.firebird", "isc_close_blob failed");
assert(false);
}
Blob_BASE::disposing();

View file

@ -27,7 +27,7 @@
#include <hsqldb/HStorageMap.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
#include <tools/diagnose_ex.h>
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::uno;
@ -76,12 +76,11 @@ extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_S
catch(const NoSuchElementException&)
{
}
catch(const Exception& e)
catch(const Exception&)
{
OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement");
TOOLS_WARN_EXCEPTION("connectivity.hsqldb", "forwarding");
if (env->ExceptionCheck())
env->ExceptionClear();
SAL_WARN("connectivity.hsqldb", "forwarding Exception: " << e);
}
}
return JNI_FALSE;
@ -117,7 +116,7 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
}
catch(const Exception& e)
{
SAL_WARN("connectivity.hsqldb", "Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement " << e);
TOOLS_WARN_EXCEPTION("connectivity.hsqldb", "");
StorageContainer::throwJavaException(e,env);
}
}

View file

@ -32,6 +32,7 @@
#include <unotools/pathoptions.hxx>
#include <connectivity/dbexception.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <tools/diagnose_ex.h>
using namespace ::com::sun::star;
@ -137,8 +138,7 @@ uno::Reference<text::XTextDocument> const& OWriterConnection::acquireDoc()
OSL_VERIFY(aLoaderException >>= aLoaderError);
SAL_WARN("connectivity.writer",
"empty m_xDoc, exception type: " << aLoaderException.getValueTypeName()
<< ", error message: " << aLoaderError);
"empty m_xDoc, " << exceptionToString(aLoaderException));
}
const OUString sError(m_aResources.getResourceStringWithSubstitution(