Handle IOException during filter detection

Change-Id: Ie2b8b65f0f2b7b34efbba478a7ccda7ef3719bd6
This commit is contained in:
Stephan Bergmann
2015-09-10 16:39:24 +02:00
parent 90b0a54792
commit 8ac129a59b
2 changed files with 93 additions and 84 deletions

View File

@@ -360,6 +360,7 @@ OUString SAL_CALL SVGFilter::detect(Sequence<PropertyValue>& rDescriptor) throw
if (!xInput.is()) if (!xInput.is())
return OUString(); return OUString();
try {
if (isStreamGZip(xInput)) if (isStreamGZip(xInput))
{ {
boost::scoped_ptr<SvStream> aStream(utl::UcbStreamHelper::CreateStream(xInput, true )); boost::scoped_ptr<SvStream> aStream(utl::UcbStreamHelper::CreateStream(xInput, true ));
@@ -387,6 +388,9 @@ OUString SAL_CALL SVGFilter::detect(Sequence<PropertyValue>& rDescriptor) throw
if (isStreamSvg(xInput)) if (isStreamSvg(xInput))
return OUString(constFilterName); return OUString(constFilterName);
} }
} catch (css::io::IOException & e) {
SAL_WARN("filter", "caught IOException " + e.Message);
}
return OUString(); return OUString();
} }

View File

@@ -229,6 +229,8 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF
} }
if( xInput.is() ) if( xInput.is() )
{ {
oslFileHandle aFile = NULL;
try {
uno::Reference< io::XSeekable > xSeek( xInput, uno::UNO_QUERY ); uno::Reference< io::XSeekable > xSeek( xInput, uno::UNO_QUERY );
if( xSeek.is() ) if( xSeek.is() )
xSeek->seek( 0 ); xSeek->seek( 0 );
@@ -255,7 +257,6 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF
} }
// check for hybrid PDF // check for hybrid PDF
oslFileHandle aFile = NULL;
if( bSuccess && if( bSuccess &&
( aURL.isEmpty() || !comphelper::isFileUrl(aURL) ) ( aURL.isEmpty() || !comphelper::isFileUrl(aURL) )
) )
@@ -297,6 +298,10 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rF
} }
osl_closeFile( aFile ); osl_closeFile( aFile );
} }
} catch (css::io::IOException & e) {
SAL_WARN("sdext.pdfimport", "caught IOException " + e.Message);
return OUString();
}
OUString aEmbedMimetype; OUString aEmbedMimetype;
xEmbedStream = getAdditionalStream( aURL, aEmbedMimetype, aPwd, m_xContext, rFilterData, false ); xEmbedStream = getAdditionalStream( aURL, aEmbedMimetype, aPwd, m_xContext, rFilterData, false );
if( aFile ) if( aFile )