summaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-09-10 16:39:24 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-09-10 16:39:24 +0200
commit8ac129a59b237e561b0884a2643030c2ce1175dd (patch)
treecab8fea097a2d01aa94d7cb224845f811ce92dbb /filter
parentDrop no-op skipBytes(0) call (diff)
downloadcore-8ac129a59b237e561b0884a2643030c2ce1175dd.tar.gz
core-8ac129a59b237e561b0884a2643030c2ce1175dd.zip
Handle IOException during filter detection
Change-Id: Ie2b8b65f0f2b7b34efbba478a7ccda7ef3719bd6
Diffstat (limited to 'filter')
-rw-r--r--filter/source/svg/svgfilter.cxx56
1 files changed, 30 insertions, 26 deletions
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index b3a56dffb630..0f20f8f9a832 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -360,32 +360,36 @@ OUString SAL_CALL SVGFilter::detect(Sequence<PropertyValue>& rDescriptor) throw
if (!xInput.is())
return OUString();
- if (isStreamGZip(xInput))
- {
- boost::scoped_ptr<SvStream> aStream(utl::UcbStreamHelper::CreateStream(xInput, true ));
- if(!aStream.get())
- return OUString();
-
- SvStream* pMemoryStream = new SvMemoryStream;
- uno::Reference<io::XSeekable> xSeek(xInput, uno::UNO_QUERY);
- if (!xSeek.is())
- return OUString();
- xSeek->seek(0);
-
- ZCodec aCodec;
- aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
- aCodec.Decompress(*aStream.get(), *pMemoryStream);
- aCodec.EndCompression();
- pMemoryStream->Seek(STREAM_SEEK_TO_BEGIN);
- uno::Reference<io::XInputStream> xDecompressedInput(new utl::OSeekableInputStreamWrapper(pMemoryStream, true));
-
- if (xDecompressedInput.is() && isStreamSvg(xDecompressedInput))
- return OUString(constFilterName);
- }
- else
- {
- if (isStreamSvg(xInput))
- return OUString(constFilterName);
+ try {
+ if (isStreamGZip(xInput))
+ {
+ boost::scoped_ptr<SvStream> aStream(utl::UcbStreamHelper::CreateStream(xInput, true ));
+ if(!aStream.get())
+ return OUString();
+
+ SvStream* pMemoryStream = new SvMemoryStream;
+ uno::Reference<io::XSeekable> xSeek(xInput, uno::UNO_QUERY);
+ if (!xSeek.is())
+ return OUString();
+ xSeek->seek(0);
+
+ ZCodec aCodec;
+ aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false, true);
+ aCodec.Decompress(*aStream.get(), *pMemoryStream);
+ aCodec.EndCompression();
+ pMemoryStream->Seek(STREAM_SEEK_TO_BEGIN);
+ uno::Reference<io::XInputStream> xDecompressedInput(new utl::OSeekableInputStreamWrapper(pMemoryStream, true));
+
+ if (xDecompressedInput.is() && isStreamSvg(xDecompressedInput))
+ return OUString(constFilterName);
+ }
+ else
+ {
+ if (isStreamSvg(xInput))
+ return OUString(constFilterName);
+ }
+ } catch (css::io::IOException & e) {
+ SAL_WARN("filter", "caught IOException " + e.Message);
}
return OUString();
}