diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-05 10:55:59 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-05 14:58:00 +0000 |
commit | ea272d9fe4bf2dc7419f76e2ddee707d768ccd50 (patch) | |
tree | ef16fc0ea4dba6f5604866f8e662b7f93b7d40b4 /filter/source | |
parent | coverity#736461 Resource leak (diff) | |
download | core-ea272d9fe4bf2dc7419f76e2ddee707d768ccd50.tar.gz core-ea272d9fe4bf2dc7419f76e2ddee707d768ccd50.zip |
coverity#737143 Uncaught exception
Change-Id: If90208f2fb9be0a44cabfc9b281b3715772b30d1
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/svg/test/svg2odf.cxx | 44 |
1 files changed, 24 insertions, 20 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() ) - { - OSL_TRACE( "Could not bootstrap UNO, installation must be in disorder. Exiting." ); - return 1; - } + ::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; + } - osl::File aInputFile(aSrcURL); - if( osl::FileBase::E_None!=aInputFile.open(osl_File_OpenFlag_Read) ) + svgi::SVGReader aReader(xCtx, + uno::Reference<io::XInputStream>( + new comphelper::OSLInputStreamWrapper(aInputFile)), + svgi::createSerializer(new OutputWrap(aDstURL))); + nRet = aReader.parseAndConvert() ? 0 : 1; + + } + catch (const uno::Exception& e) { - OSL_TRACE( "Cannot open input file" ); + SAL_WARN("vcl.app", "Fatal exception: " << e.Message); return 1; } - - svgi::SVGReader aReader(xCtx, - uno::Reference<io::XInputStream>( - new comphelper::OSLInputStreamWrapper(aInputFile)), - svgi::createSerializer(new OutputWrap(aDstURL))); - return aReader.parseAndConvert() ? 0 : 1; + return nRet; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |