diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-02-28 18:03:04 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-02-28 18:05:51 +0100 |
commit | 33ca98314133a93e71edb1a003fe8ddb7b36e8a9 (patch) | |
tree | 24d2bd03aefc684843b686c54e343aeb50cb7400 /svgio | |
parent | d12324d13620e5acda63b1b0c21731fecc49aa01 (diff) |
Catching MalformedUriException subsumes the rPath.isEmpty() case now
...so that is no longer necessary, and checking for rPath.isEmpty() first also
mis-handled the case where rPath was empty but maUrl was already absolute.
Change-Id: Ieae800dd6c52f0cc308944ca0035ea4140d3a324
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/source/svgreader/svgimagenode.cxx | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx index 39994a8fcaec..e575502394dd 100644 --- a/svgio/source/svgreader/svgimagenode.cxx +++ b/svgio/source/svgreader/svgimagenode.cxx @@ -234,45 +234,33 @@ namespace svgio else if(!maUrl.isEmpty()) { const OUString& rPath = getDocument().getAbsolutePath(); + OUString aAbsUrl; + try { + aAbsUrl = rtl::Uri::convertRelToAbs(rPath, maUrl); + } catch (rtl::MalformedUriException & e) { + // Happens for the odd rPath = + // "vnd.sun.star.Package:Pictures/..." scheme using + // path components not starting with a slash by mis- + // design: + SAL_INFO( + "svg", + "caught rtl::MalformedUriException \"" + << e.getMessage() << "\""); + } - if (!rPath.isEmpty()) + if (!aAbsUrl.isEmpty()) { - OUString aAbsUrl; - try { - aAbsUrl = rtl::Uri::convertRelToAbs( - rPath, maUrl); - } catch (rtl::MalformedUriException & e) { - // Happens for the odd rPath = - // "vnd.sun.star.Package:Pictures/..." scheme - // using path components not starting with a - // slash by mis-design: - SAL_INFO( - "svg", - "caught rtl::MalformedUriException \"" - << e.getMessage() << "\""); - } + SvFileStream aStream(aAbsUrl, STREAM_STD_READ); + Graphic aGraphic; - if (!aAbsUrl.isEmpty()) + if(GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic( + aGraphic, + aAbsUrl, + aStream)) { - SvFileStream aStream(aAbsUrl, STREAM_STD_READ); - Graphic aGraphic; - - if(GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic( - aGraphic, - aAbsUrl, - aStream)) - { - extractFromGraphic(aGraphic, aNewTarget, aViewBox, aBitmapEx); - } + extractFromGraphic(aGraphic, aNewTarget, aViewBox, aBitmapEx); } } - else - { - // #i123042# detect missing path and assert - content will be missing. The - // absolute path to itself needs to be set to correctly import linked - // content in a SVG file - OSL_ENSURE(false, "SVG graphic with internal links is interpreted, but local AbsolutePath is not set: linked content will be missing (!)"); - } } else if(!maXLink.isEmpty()) { |