You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by js...@apache.org on 2013/10/21 17:55:07 UTC

svn commit: r1534248 - /openoffice/trunk/main/io/source/TextOutputStream/TextOutputStream.cxx

Author: jsc
Date: Mon Oct 21 15:55:06 2013
New Revision: 1534248

URL: http://svn.apache.org/r1534248
Log:
#75731# check output stream and throw IOExceptioin if it is not intiliazed

Modified:
    openoffice/trunk/main/io/source/TextOutputStream/TextOutputStream.cxx

Modified: openoffice/trunk/main/io/source/TextOutputStream/TextOutputStream.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/io/source/TextOutputStream/TextOutputStream.cxx?rev=1534248&r1=1534247&r2=1534248&view=diff
==============================================================================
--- openoffice/trunk/main/io/source/TextOutputStream/TextOutputStream.cxx (original)
+++ openoffice/trunk/main/io/source/TextOutputStream/TextOutputStream.cxx Mon Oct 21 15:55:06 2013
@@ -74,7 +74,8 @@ class OTextOutputStream : public TextOut
 	rtl_UnicodeToTextContext   	mContextUnicode2Text;
 
 	Sequence<sal_Int8> implConvert( const OUString& rSource );
-
+    void checkOutputStream() throw(IOException);
+    
 public:
 	OTextOutputStream();
 	~OTextOutputStream();
@@ -174,6 +175,7 @@ Sequence<sal_Int8> OTextOutputStream::im
 void OTextOutputStream::writeString( const OUString& aString ) 
 	throw(IOException, RuntimeException)
 {
+    checkOutputStream();
 	if( !mbEncodingInitialized )
 	{
 		OUString aUtf8Str( RTL_CONSTASCII_USTRINGPARAM("utf8") );
@@ -205,22 +207,35 @@ void OTextOutputStream::setEncoding( con
 void OTextOutputStream::writeBytes( const Sequence< sal_Int8 >& aData ) 
 	throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
 {
+    checkOutputStream();
 	mxStream->writeBytes( aData );
 }
 
 void OTextOutputStream::flush(  ) 
 	throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
 {
+    checkOutputStream();
 	mxStream->flush();
 }
 
 void OTextOutputStream::closeOutput(  ) 
 	throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
 {
+    checkOutputStream();
 	mxStream->closeOutput();
 }
 
 
+void OTextOutputStream::checkOutputStream()
+    throw(IOException)
+{
+    if (! mxStream.is() )
+        throw IOException(
+            OUString(RTL_CONSTASCII_USTRINGPARAM("output stream is not initialized, you have to use setOutputStream first")),
+            Reference<XInterface>());
+}
+
+
 //===========================================================================
 // XActiveDataSource