From ea272d9fe4bf2dc7419f76e2ddee707d768ccd50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 5 Nov 2014 10:55:59 +0000 Subject: [PATCH] coverity#737143 Uncaught exception Change-Id: If90208f2fb9be0a44cabfc9b281b3715772b30d1 --- filter/source/svg/test/svg2odf.cxx | 46 ++++++++++++++++-------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/filter/source/svg/test/svg2odf.cxx b/filter/source/svg/test/svg2odf.cxx index d923dd42715a..78188fa4ca1a 100644 --- a/filter/source/svg/test/svg2odf.cxx +++ b/filter/source/svg/test/svg2odf.cxx @@ -90,36 +90,40 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) // bootstrap UNO uno::Reference< lang::XMultiServiceFactory > xFactory; uno::Reference< uno::XComponentContext > xCtx; + int nRet = 1; try { xCtx = ::cppu::defaultBootstrap_InitialComponentContext(aIniUrl); xFactory = uno::Reference< lang::XMultiServiceFactory >(xCtx->getServiceManager(), uno::UNO_QUERY); - if( xFactory.is() ) - ::comphelper::setProcessServiceFactory( xFactory ); - } - catch( const uno::Exception& ) - { - } + if (!xFactory.is()) + { + OSL_TRACE( "Could not bootstrap UNO, installation must be in disorder. Exiting." ); + return 1; + } - if( !xFactory.is() ) + ::comphelper::setProcessServiceFactory( xFactory ); + + osl::File aInputFile(aSrcURL); + if( osl::FileBase::E_None!=aInputFile.open(osl_File_OpenFlag_Read) ) + { + OSL_TRACE( "Cannot open input file" ); + return 1; + } + + svgi::SVGReader aReader(xCtx, + uno::Reference( + new comphelper::OSLInputStreamWrapper(aInputFile)), + svgi::createSerializer(new OutputWrap(aDstURL))); + nRet = aReader.parseAndConvert() ? 0 : 1; + + } + catch (const uno::Exception& e) { - OSL_TRACE( "Could not bootstrap UNO, installation must be in disorder. Exiting." ); + SAL_WARN("vcl.app", "Fatal exception: " << e.Message); return 1; } - - osl::File aInputFile(aSrcURL); - if( osl::FileBase::E_None!=aInputFile.open(osl_File_OpenFlag_Read) ) - { - OSL_TRACE( "Cannot open input file" ); - return 1; - } - - svgi::SVGReader aReader(xCtx, - uno::Reference( - new comphelper::OSLInputStreamWrapper(aInputFile)), - svgi::createSerializer(new OutputWrap(aDstURL))); - return aReader.parseAndConvert() ? 0 : 1; + return nRet; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */