Kaydet (Commit) 6e3ac01f authored tarafından Michael Stahl's avatar Michael Stahl

fdo#68084: OOXML import: handle exceptions if stream is missing

The bugdoc does not have a styles.xml but a stylesWithEffects.xml,
whatever that may mean.  (the app.xml contains "Microsoft Macintosh Word")

Change-Id: If3d11c5d166dcaf3d94129339559787c20e6db46
üst 889da158
...@@ -2136,7 +2136,11 @@ SotElement_Impl* OStorage::OpenStreamElement_Impl( const OUString& aStreamName, ...@@ -2136,7 +2136,11 @@ SotElement_Impl* OStorage::OpenStreamElement_Impl( const OUString& aStreamName,
if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE )
|| (( nOpenMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE ) || (( nOpenMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE )
|| ( nOpenMode & embed::ElementModes::NOCREATE ) == embed::ElementModes::NOCREATE ) || ( nOpenMode & embed::ElementModes::NOCREATE ) == embed::ElementModes::NOCREATE )
throw io::IOException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() ); // TODO: access_denied {
throw io::IOException("Element does not exist and cannot be "
"created: \"" + aStreamName + "\"",
uno::Reference< uno::XInterface >()); // TODO: access_denied
}
// create a new StreamElement and insert it into the list // create a new StreamElement and insert it into the list
pElement = m_pImpl->InsertStream( aStreamName, bEncr ); pElement = m_pImpl->InsertStream( aStreamName, bEncr );
......
...@@ -54,8 +54,17 @@ OOXMLDocumentImpl::~OOXMLDocumentImpl() ...@@ -54,8 +54,17 @@ OOXMLDocumentImpl::~OOXMLDocumentImpl()
void OOXMLDocumentImpl::resolveFastSubStream(Stream & rStreamHandler, void OOXMLDocumentImpl::resolveFastSubStream(Stream & rStreamHandler,
OOXMLStream::StreamType_t nType) OOXMLStream::StreamType_t nType)
{ {
OOXMLStream::Pointer_t pStream OOXMLStream::Pointer_t pStream;
(OOXMLDocumentFactory::createStream(mpStream, nType)); try
{
pStream = OOXMLDocumentFactory::createStream(mpStream, nType);
}
catch (uno::Exception const& e)
{
SAL_INFO("writerfilter", "resolveFastSubStream: exception while "
"resolving stream " << nType << " : " << e.Message);
return;
}
OOXMLStream::Pointer_t savedStream = mpStream; OOXMLStream::Pointer_t savedStream = mpStream;
mpStream = pStream; mpStream = pStream;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment