diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-15 13:12:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-15 19:57:59 +0200 |
commit | 8d234284d0ec0393e8d9d5057f68f48f33bc8d9d (patch) | |
tree | 7d08fffc27aa49ad3024afa8fa05418029457efd | |
parent | dc9d11e20aca4f7df7bd3d11d84e963ce4abf2bc (diff) |
loplugin:logexceptionnicely in linguistic..oox
Change-Id: I3f96494f5fecb2f1011578b768198c1204147202
Reviewed-on: https://gerrit.libreoffice.org/74099
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | linguistic/source/gciterator.cxx | 6 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 17 | ||||
-rw-r--r-- | oox/source/drawingml/textfield.cxx | 4 | ||||
-rw-r--r-- | oox/source/export/chartexport.cxx | 9 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 6 | ||||
-rw-r--r-- | oox/source/export/shapes.cxx | 17 | ||||
-rw-r--r-- | oox/source/helper/propertyset.cxx | 13 | ||||
-rw-r--r-- | oox/source/helper/zipstorage.cxx | 35 | ||||
-rw-r--r-- | oox/source/ole/axcontrol.cxx | 23 | ||||
-rw-r--r-- | oox/source/ppt/timenode.cxx | 13 | ||||
-rw-r--r-- | oox/source/vml/vmldrawing.cxx | 4 |
11 files changed, 75 insertions, 72 deletions
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index 7aca99026250..9c8aed2a49a7 100644 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -677,11 +677,9 @@ void GrammarCheckingIterator::DequeueAndCheck() AddEntry( xFPIterator, xFlatParaNext, aCurDocId, 0, aFPEntryItem.m_bAutomatic ); } } - catch (css::uno::Exception & e) + catch (css::uno::Exception &) { - SAL_WARN( - "linguistic", - "GrammarCheckingIterator::DequeueAndCheck ignoring " << e); + TOOLS_WARN_EXCEPTION("linguistic", "GrammarCheckingIterator::DequeueAndCheck ignoring"); } } diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 6e19aa77841f..164de7d8a140 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -51,6 +51,7 @@ #include <comphelper/propertysequence.hxx> #include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> +#include <tools/diagnose_ex.h> #include <tools/gen.hxx> #include <tools/globname.hxx> #include <tools/mapunit.hxx> @@ -296,9 +297,9 @@ void Shape::addShape( } } } - catch( const Exception& e ) + catch( const Exception& ) { - SAL_WARN( "oox.drawingml", "Shape::addShape: " << e ); + TOOLS_WARN_EXCEPTION( "oox.drawingml", "Shape::addShape" ); } } @@ -1500,9 +1501,9 @@ void Shape::keepDiagramCompatibilityInfo() } else xSet->setPropertyValue( aGrabBagPropName, Any( maDiagramDoms ) ); } - catch( const Exception& e ) + catch( const Exception& ) { - SAL_WARN( "oox.drawingml", "Shape::keepDiagramCompatibilityInfo: " << e ); + TOOLS_WARN_EXCEPTION( "oox.drawingml", "Shape::keepDiagramCompatibilityInfo" ); } } @@ -1523,9 +1524,9 @@ void Shape::convertSmartArtToMetafile(XmlFilterBase const & rFilterBase) xShapes->remove(Reference<XShape>(xShapes->getByIndex(0), UNO_QUERY_THROW)); xShapes->add(xShape); } - catch (const Exception& e) + catch (const Exception&) { - SAL_WARN("oox.drawingml", "Shape::convertSmartArtToMetafile: " << e); + TOOLS_WARN_EXCEPTION("oox.drawingml", "Shape::convertSmartArtToMetafile"); } } @@ -1592,9 +1593,9 @@ Reference < XShape > Shape::renderDiagramToGraphic( XmlFilterBase const & rFilte xPropSet->setPropertyValue( "SizeProtect", Any( true ) ); xPropSet->setPropertyValue( "Name", Any( OUString( "RenderedShapes" ) ) ); } - catch( const Exception& e ) + catch( const Exception& ) { - SAL_WARN( "oox.drawingml", "Shape::renderDiagramToGraphic: " << e ); + TOOLS_WARN_EXCEPTION( "oox.drawingml", "Shape::renderDiagramToGraphic" ); } return xShape; diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx index 713c5a745b3d..545327e36228 100644 --- a/oox/source/drawingml/textfield.cxx +++ b/oox/source/drawingml/textfield.cxx @@ -130,9 +130,9 @@ void lclCreateTextFields( std::vector< Reference< XTextField > > & aFields, xProps->setPropertyValue( "IsDate", makeAny( bIsDate ) ); xProps->setPropertyValue( "IsFixed", makeAny( false ) ); } - catch(Exception & e) + catch(const Exception &) { - SAL_WARN("oox", e ); + TOOLS_WARN_EXCEPTION("oox", ""); } } else if ( sType == "slidenum" ) diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 95962aa1d656..cf5b645bd937 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1291,9 +1291,9 @@ void ChartExport::exportBitmapFill( const Reference< XPropertySet >& xPropSet ) } } } - catch (const uno::Exception & rEx) + catch (const uno::Exception &) { - SAL_INFO("oox", "ChartExport::exportBitmapFill " << rEx); + TOOLS_WARN_EXCEPTION("oox", "ChartExport::exportBitmapFill"); } } } @@ -1318,10 +1318,9 @@ void ChartExport::exportGradientFill( const Reference< XPropertySet >& xPropSet mpFS->endElementNS( XML_a, XML_gradFill ); } } - catch (const uno::Exception & rEx) + catch (const uno::Exception &) { - SAL_INFO("oox", - "ChartExport::exportGradientFill " << rEx); + TOOLS_INFO_EXCEPTION("oox", "ChartExport::exportGradientFill"); } } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 85834a14b1b0..c87cb3a1f617 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -36,6 +36,7 @@ #include <oox/drawingml/drawingmltypes.hxx> #include <svtools/unitconv.hxx> #include <sax/fastattribs.hxx> +#include <tools/diagnose_ex.h> #include <i18nlangtag/languagetag.hxx> #include <cstdio> @@ -4275,10 +4276,9 @@ void DrawingML::writeDiagramRels(const uno::Sequence<uno::Sequence<uno::Any>>& x { comphelper::OStorageHelper::CopyInputToOutput(dataImagebin, xBinOutStream); } - catch (const uno::Exception& rException) + catch (const uno::Exception&) { - SAL_WARN("oox.drawingml", "DrawingML::writeDiagramRels Failed to copy grabbaged Image: " - << rException); + TOOLS_WARN_EXCEPTION("oox.drawingml", "DrawingML::writeDiagramRels Failed to copy grabbaged Image"); } dataImagebin->closeInput(); } diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index b36ebb26f67f..d441406ae95f 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -96,6 +96,7 @@ #include <filter/msfilter/escherex.hxx> #include <svx/svdoashp.hxx> #include <svx/svdoole2.hxx> +#include <tools/diagnose_ex.h> #include <editeng/svxenum.hxx> #include <svx/unoapi.hxx> #include <oox/export/chartexport.hxx> @@ -287,9 +288,9 @@ static uno::Reference<io::XInputStream> lcl_StoreOwnAsOOXML( { xStorable->storeToURL("private:stream", args); } - catch (uno::Exception const& e) + catch (uno::Exception const&) { - SAL_WARN("oox.shape", "oox::GetOLEObjectStream: " << e); + TOOLS_WARN_EXCEPTION("oox.shape", "oox::GetOLEObjectStream"); return nullptr; } xTempStream->getOutputStream()->closeOutput(); @@ -327,9 +328,9 @@ uno::Reference<io::XInputStream> GetOLEObjectStream( o_rpProgID, o_rMediaType, o_rRelationType, o_rSuffix); } } - catch (uno::Exception const& e) + catch (uno::Exception const&) { - SAL_WARN("oox.shape", "oox::GetOLEObjectStream: " << e); + TOOLS_WARN_EXCEPTION("oox.shape", "oox::GetOLEObjectStream"); } return xInStream; } @@ -1951,9 +1952,9 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape ) entryName = uno::Reference<embed::XEmbedPersist>(xObj, uno::UNO_QUERY_THROW)->getEntryName(); } - catch (uno::Exception const& e) + catch (uno::Exception const&) { - SAL_WARN("oox.shape", "ShapeExport::WriteOLE2Shape: " << e); + TOOLS_WARN_EXCEPTION("oox.shape", "ShapeExport::WriteOLE2Shape"); return *this; } @@ -2021,8 +2022,8 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape ) try { ::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream); - } catch (uno::Exception const& e) { - SAL_WARN("oox.shape", "ShapeExport::WriteOLEObject: " << e); + } catch (uno::Exception const&) { + TOOLS_WARN_EXCEPTION("oox.shape", "ShapeExport::WriteOLEObject"); } OUString const sRelId = mpFB->addRelation( diff --git a/oox/source/helper/propertyset.cxx b/oox/source/helper/propertyset.cxx index 02abed12cd5f..ca972c8f3c90 100644 --- a/oox/source/helper/propertyset.cxx +++ b/oox/source/helper/propertyset.cxx @@ -24,6 +24,7 @@ #include <osl/diagnose.h> #include <rtl/strbuf.hxx> #include <sal/log.hxx> +#include <tools/diagnose_ex.h> #include <oox/helper/propertymap.hxx> namespace oox { @@ -117,10 +118,10 @@ bool PropertySet::implGetPropertyValue( Any& orValue, const OUString& rPropName orValue = mxPropSet->getPropertyValue( rPropName ); return true; } - catch( Exception& e) + catch( const Exception&) { - SAL_WARN( "oox", "PropertySet::implGetPropertyValue - cannot get property \"" << - rPropName << "\" Error: " << e); + TOOLS_WARN_EXCEPTION( "oox", "PropertySet::implGetPropertyValue - cannot get property \"" << + rPropName << "\""); } return false; } @@ -132,10 +133,10 @@ bool PropertySet::implSetPropertyValue( const OUString& rPropName, const Any& rV mxPropSet->setPropertyValue( rPropName, rValue ); return true; } - catch( Exception& e) + catch( const Exception&) { - SAL_WARN( "oox", "PropertySet::implSetPropertyValue - cannot set property \"" << - rPropName << "\" Error: " << e); + TOOLS_WARN_EXCEPTION( "oox", "PropertySet::implSetPropertyValue - cannot set property \"" << + rPropName << "\""); } return false; } diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx index 2dbf3cdf2700..3de75bf68b94 100644 --- a/oox/source/helper/zipstorage.cxx +++ b/oox/source/helper/zipstorage.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <osl/diagnose.h> #include <sal/log.hxx> +#include <tools/diagnose_ex.h> #include <comphelper/storagehelper.hxx> #include <oox/helper/helper.hxx> @@ -61,10 +62,9 @@ ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const R mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( ZIP_STORAGE_FORMAT_STRING, rxInStream, rxContext, false); } - catch (Exception const& e) + catch (Exception const&) { - SAL_WARN("oox.storage", "ZipStorage::ZipStorage " - "exception opening input storage: " << e); + TOOLS_WARN_EXCEPTION("oox.storage", "ZipStorage::ZipStorage exception opening input storage"); } } @@ -79,10 +79,9 @@ ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const R mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( OFOPXML_STORAGE_FORMAT_STRING, rxStream, nOpenMode, rxContext, true); } - catch (Exception const& e) + catch (Exception const&) { - SAL_WARN("oox.storage", "ZipStorage::ZipStorage " - "exception opening output storage: " << e); + TOOLS_WARN_EXCEPTION("oox.storage", "ZipStorage::ZipStorage exception opening output storage"); } } @@ -117,9 +116,9 @@ void ZipStorage::implGetElementNames( ::std::vector< OUString >& orElementNames if( aNames.hasElements() ) orElementNames.insert( orElementNames.end(), aNames.begin(), aNames.end() ); } - catch (Exception const& e) + catch (Exception const&) { - SAL_INFO("oox.storage", "getElementNames: " << e); + TOOLS_INFO_EXCEPTION("oox.storage", "getElementNames"); } } @@ -138,9 +137,9 @@ StorageRef ZipStorage::implOpenSubStorage( const OUString& rElementName, bool bC { bMissing = true; } - catch (Exception const& e) + catch (Exception const&) { - SAL_INFO("oox.storage", "openStorageElement: " << e); + TOOLS_INFO_EXCEPTION("oox.storage", "openStorageElement"); } if( bMissing && bCreateMissing ) try @@ -148,9 +147,9 @@ StorageRef ZipStorage::implOpenSubStorage( const OUString& rElementName, bool bC xSubXStorage = mxStorage->openStorageElement( rElementName, css::embed::ElementModes::READWRITE ); } - catch (Exception const& e) + catch (Exception const&) { - SAL_INFO("oox.storage", "openStorageElement: " << e); + TOOLS_INFO_EXCEPTION("oox.storage", "openStorageElement"); } StorageRef xSubStorage; @@ -166,9 +165,9 @@ Reference< XInputStream > ZipStorage::implOpenInputStream( const OUString& rElem { xInStream.set( mxStorage->openStreamElement( rElementName, css::embed::ElementModes::READ ), UNO_QUERY ); } - catch (Exception const& e) + catch (Exception const&) { - SAL_INFO("oox.storage", "openStreamElement: " << e); + TOOLS_INFO_EXCEPTION("oox.storage", "openStreamElement"); } return xInStream; } @@ -180,9 +179,9 @@ Reference< XOutputStream > ZipStorage::implOpenOutputStream( const OUString& rEl { xOutStream.set( mxStorage->openStreamElement( rElementName, css::embed::ElementModes::READWRITE ), UNO_QUERY ); } - catch (Exception const& e) + catch (Exception const&) { - SAL_INFO("oox.storage", "openStreamElement: " << e); + TOOLS_INFO_EXCEPTION("oox.storage", "openStreamElement"); } return xOutStream; } @@ -193,9 +192,9 @@ void ZipStorage::implCommit() const { Reference< XTransactedObject >( mxStorage, UNO_QUERY_THROW )->commit(); } - catch (Exception const& e) + catch (Exception const&) { - SAL_WARN("oox.storage", "commit: " << e); + TOOLS_WARN_EXCEPTION("oox.storage", "commit"); } } diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 2826ca06714e..02a6d1ce70bf 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -178,9 +178,10 @@ bool lclExtractRangeFromName( CellRangeAddress& orRangeAddr, const Reference< XM orRangeAddr = xAddressable->getRangeAddress(); return true; } - catch (const Exception& e) + catch (const Exception&) { - SAL_WARN("oox", e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("oox", exceptionToString(ex)); } return false; } @@ -211,9 +212,10 @@ void lclPrepareConverter( PropertySet& rConverter, const Reference< XModel >& rx OUString( "com.sun.star.table.CellAddressConversion" ); rConverter.set( xModelFactory->createInstance( aServiceName ) ); } - catch (const Exception& e) + catch (const Exception&) { - SAL_WARN("oox", e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("oox", exceptionToString(ex)); } rConverter.setProperty( PROP_XLA1Representation, rAddressString ); rConverter.setProperty( PROP_ReferenceSheet, nRefSheet ); @@ -355,9 +357,10 @@ void ControlConverter::bindToSources( const Reference< XControlModel >& rxCtrlMo Reference< XValueBinding > xBinding( xModelFactory->createInstanceWithArguments( "com.sun.star.table.CellValueBinding", aArgs ), UNO_QUERY_THROW ); xBindable->setValueBinding( xBinding ); } - catch (const Exception& e) + catch (const Exception&) { - SAL_WARN("oox", e); + css::uno::Any ex( cppu::getCaughtException() ); + SAL_WARN("oox", exceptionToString(ex)); } // list entry source @@ -387,9 +390,9 @@ void ControlConverter::bindToSources( const Reference< XControlModel >& rxCtrlMo Reference< XListEntrySource > xEntrySource( xModelFactory->createInstanceWithArguments("com.sun.star.table.CellRangeListSource", aArgs ), UNO_QUERY_THROW ); xEntrySink->setListEntrySource( xEntrySource ); } - catch (const Exception& e) + catch (const Exception&) { - SAL_WARN("oox", e); + TOOLS_WARN_EXCEPTION("oox", ""); } } @@ -2694,9 +2697,9 @@ bool EmbeddedControl::convertProperties( const Reference< XControlModel >& rxCtr { aPropMap.setProperty( PROP_GenerateVbaEvents, true); } - catch (const Exception& e) + catch (const Exception&) { - SAL_WARN("oox", e); + TOOLS_WARN_EXCEPTION("oox", ""); } mxModel->convertProperties( aPropMap, rConv ); PropertySet aPropSet( rxCtrlModel ); diff --git a/oox/source/ppt/timenode.cxx b/oox/source/ppt/timenode.cxx index b3391ddd6005..8d61a078ec77 100644 --- a/oox/source/ppt/timenode.cxx +++ b/oox/source/ppt/timenode.cxx @@ -42,6 +42,7 @@ #include <oox/ppt/pptfilterhelpers.hxx> #include <oox/token/tokens.hxx> #include <sal/log.hxx> +#include <tools/diagnose_ex.h> using namespace ::oox::core; using namespace ::com::sun::star::beans; @@ -210,9 +211,9 @@ namespace oox { namespace ppt { return; setNode(rFilter, xNode, pSlide, rxNode); } - catch( const Exception& e ) + catch( const Exception& ) { - SAL_INFO("oox.ppt","OOX: exception raised in TimeNode::addNode() - " << e ); + TOOLS_INFO_EXCEPTION("oox.ppt","OOX: exception raised in TimeNode::addNode()" ); } } @@ -582,9 +583,9 @@ namespace oox { namespace ppt { break; } } - catch( const Exception& e ) + catch( const Exception& ) { - SAL_INFO("oox.ppt","OOX: exception raised in TimeNode::setNode() - " << e ); + TOOLS_INFO_EXCEPTION("oox.ppt","OOX: exception raised in TimeNode::setNode()"); } } @@ -600,9 +601,9 @@ namespace oox { namespace ppt { xParentContainer->appendChild( xNode ); return xNode; } - catch( const Exception& e ) + catch( const Exception& ) { - SAL_INFO("oox.ppt", "OOX: exception raised in TimeNode::createAndInsert() trying to create a service " << rServiceName << " = " << e ); + TOOLS_INFO_EXCEPTION("oox.ppt", "OOX: exception raised in TimeNode::createAndInsert() trying to create a service " << rServiceName); } return Reference< XAnimationNode >(); diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx index 6fa26118f246..d8fccb56ff30 100644 --- a/oox/source/vml/vmldrawing.cxx +++ b/oox/source/vml/vmldrawing.cxx @@ -282,9 +282,9 @@ Reference< XShape > Drawing::createAndInsertXShape( const OUString& rService, } xShape->setSize( awt::Size( rShapeRect.Width, rShapeRect.Height ) ); } - catch( Exception& e ) + catch( const Exception& ) { - SAL_WARN( "oox", "Drawing::createAndInsertXShape - error during shape object creation: " << e ); + TOOLS_WARN_EXCEPTION( "oox", "Drawing::createAndInsertXShape - error during shape object creation" ); } OSL_ENSURE( xShape.is(), "Drawing::createAndInsertXShape - cannot instantiate shape object" ); return xShape; |