summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-11-05 10:38:32 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-11-05 14:57:59 +0000
commit7ddfa141d3de8f2a431b5844254f23f7b7aeb1fa (patch)
treeba2e15a5eb3498d74e8c2251b85f24d59c2e841c /sdext
parent8310ff534e4df002912d9315c13dde7f0627c650 (diff)
coverity#1019393 Uncaught exception
Change-Id: I818a91a3090392efed46700b5e2d77d7f1e3bdb9
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/pdfimport/test/pdf2xml.cxx64
1 files changed, 36 insertions, 28 deletions
diff --git a/sdext/source/pdfimport/test/pdf2xml.cxx b/sdext/source/pdfimport/test/pdf2xml.cxx
index 88b3535bfff1..f081097c52d0 100644
--- a/sdext/source/pdfimport/test/pdf2xml.cxx
+++ b/sdext/source/pdfimport/test/pdf2xml.cxx
@@ -39,40 +39,48 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
if( argc < 4 )
return 1;
- OUString aBaseURL, aTmpURL, aSrcURL, aDstURL;
+ try
+ {
+ OUString aBaseURL, aTmpURL, aSrcURL, aDstURL;
- TreeVisitorFactorySharedPtr pTreeFactory;
- if( rtl_str_compare(argv[1], "-writer") == 0 )
- pTreeFactory = createWriterTreeVisitorFactory();
- else if( rtl_str_compare(argv[1], "-draw") == 0 )
- pTreeFactory = createDrawTreeVisitorFactory();
- else if( rtl_str_compare(argv[1], "-impress") == 0 )
- pTreeFactory = createImpressTreeVisitorFactory();
- else
- return 1;
+ TreeVisitorFactorySharedPtr pTreeFactory;
+ if( rtl_str_compare(argv[1], "-writer") == 0 )
+ pTreeFactory = createWriterTreeVisitorFactory();
+ else if( rtl_str_compare(argv[1], "-draw") == 0 )
+ pTreeFactory = createDrawTreeVisitorFactory();
+ else if( rtl_str_compare(argv[1], "-impress") == 0 )
+ pTreeFactory = createImpressTreeVisitorFactory();
+ else
+ return 1;
- osl_getProcessWorkingDir(&aBaseURL.pData);
- osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[2]).pData,
- &aTmpURL.pData );
- osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aSrcURL.pData);
+ osl_getProcessWorkingDir(&aBaseURL.pData);
+ osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[2]).pData,
+ &aTmpURL.pData );
+ osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aSrcURL.pData);
- osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[3]).pData,
- &aTmpURL.pData );
- osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aDstURL.pData);
+ osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[3]).pData,
+ &aTmpURL.pData );
+ osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aDstURL.pData);
- // bootstrap UNO
- uno::Reference< uno::XComponentContext > xContext(
- cppu::defaultBootstrap_InitialComponentContext() );
- uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager());
- uno::Reference<lang::XMultiServiceFactory> xSM(xFactory, uno::UNO_QUERY_THROW);
- comphelper::setProcessServiceFactory(xSM);
+ // bootstrap UNO
+ uno::Reference< uno::XComponentContext > xContext(
+ cppu::defaultBootstrap_InitialComponentContext() );
+ uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager());
+ uno::Reference<lang::XMultiServiceFactory> xSM(xFactory, uno::UNO_QUERY_THROW);
+ comphelper::setProcessServiceFactory(xSM);
- test::BootstrapFixtureBase aEnv;
- aEnv.setUp();
+ test::BootstrapFixtureBase aEnv;
+ aEnv.setUp();
- pdfi::PDFIRawAdaptor aAdaptor( aEnv.getComponentContext() );
- aAdaptor.setTreeVisitorFactory(pTreeFactory);
- aAdaptor.odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL );
+ pdfi::PDFIRawAdaptor aAdaptor( aEnv.getComponentContext() );
+ aAdaptor.setTreeVisitorFactory(pTreeFactory);
+ aAdaptor.odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL );
+ }
+ catch (const uno::Exception& e)
+ {
+ SAL_WARN("vcl.app", "Fatal exception: " << e.Message);
+ return 1;
+ }
return 0;
}