summaryrefslogtreecommitdiff
path: root/package/source/xstor
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2004-07-23 10:12:48 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2004-07-23 10:12:48 +0000
commit94763447970de203a1b983ca30b936b1148a8da8 (patch)
tree62afa054ba7b371907d6e6685af8599664afff67 /package/source/xstor
parentc5fd29a783622184b24c1a5e5772515a77eccbff (diff)
INTEGRATION: CWS fwklhf01 (1.6.14); FILE MERGED
2004/06/23 09:57:53 mav 1.6.14.1: #i29321# handle gracefuly cases when nonmodified storage is commited and nothing is written to a new stream
Diffstat (limited to 'package/source/xstor')
-rw-r--r--package/source/xstor/owriteablestream.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 6f76c360994e..4b20953e336b 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: owriteablestream.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: hr $ $Date: 2004-05-10 17:28:08 $
+ * last change: $Author: hr $ $Date: 2004-07-23 11:12:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -305,6 +305,7 @@ void OWriteStream_Impl::InsertIntoPackageFolder( const ::rtl::OUString& aName,
{
::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
+ OSL_ENSURE( m_bFlushed, "This method must not be called for nonflushed streams!\n" );
if ( m_bFlushed )
{
OSL_ENSURE( m_xPackageStream.is(), "An inserted stream is incomplete!\n" );
@@ -963,6 +964,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
else
xInStream = m_xPackageStream->getDataStream();
+ // The stream does not exist in the storage
if ( !xInStream.is() )
throw io::IOException();
@@ -978,6 +980,12 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
}
else if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::SEEKABLEREAD )
{
+ if ( !m_aTempURL.getLength() && !( m_xPackageStream->getDataStream().is() ) )
+ {
+ // The stream does not exist in the storage
+ throw io::IOException();
+ }
+
uno::Reference< io::XInputStream > xInStream;
xInStream = GetTempFileAsInputStream(); //TODO:
@@ -1009,10 +1017,20 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
// open new empty temp file
m_aTempURL = GetNewTempFileURL( GetServiceFactory() );
+ m_bHasDataToFlush = sal_True;
+
xStream = GetTempFileAsStream();
}
else
+ {
+ if ( !m_aTempURL.getLength() && !( m_xPackageStream->getDataStream().is() ) )
+ {
+ // The stream does not exist in the storage
+ m_bHasDataToFlush = sal_True;
+ }
+
xStream = GetTempFileAsStream();
+ }
m_pAntiImpl = new OWriteStream( this, xStream );
uno::Reference< io::XStream > xWriteStream =