diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-06-16 16:15:54 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-06-16 16:15:54 +0000 |
commit | 8083b46285fefc4af751e1b00d20b40bea196ea8 (patch) | |
tree | 6c5059dd2f96058a1102f25fee46512154c757fb | |
parent | de6a6709931b8b0dcd30a7f08e92bd858f286a1b (diff) |
CWS-TOOLING: integrate CWS fwk103
2009-05-26 12:44:25 +0200 mst r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
+ fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
+ adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst r271393 : - sw/source/filter/html/swhtml.cxx:
+ fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
+ move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
+ move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
to HTMLParser (svtools)
+ make HTMLParser::ParseMetaOptions() a virtual function
+ HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
+ new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
+ enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
sc/source/filter/html/htmlpars.cxx:
+ remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
+ new SwHTMLParser::AddMetaUserDefined() for import of
DOCINFO field subtypes INFO[1-4]
+ do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
+ use proper operator delete[]
2009-02-26 15:23:10 +0100 mav r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
22 files changed, 1970 insertions, 782 deletions
diff --git a/embedserv/source/inprocserv/inprocembobj.cxx b/embedserv/source/inprocserv/inprocembobj.cxx index 895427e1646c..474f707d86f1 100644 --- a/embedserv/source/inprocserv/inprocembobj.cxx +++ b/embedserv/source/inprocserv/inprocembobj.cxx @@ -863,7 +863,6 @@ STDMETHODIMP InprocEmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, L { WRITEDEBUGINFO( "InprocEmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj )" ); - HRESULT hr = S_OK; if ( CheckDefHandler() ) { ComSmart< IOleObject > pOleObject; @@ -877,7 +876,7 @@ STDMETHODIMP InprocEmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, L } } - return hr; + return S_OK; } //------------------------------------------------------------------------------- diff --git a/package/source/manifest/ManifestDefines.hxx b/package/source/manifest/ManifestDefines.hxx index a2d8e92475bb..78d262358a0f 100644 --- a/package/source/manifest/ManifestDefines.hxx +++ b/package/source/manifest/ManifestDefines.hxx @@ -32,6 +32,7 @@ #include <PackageConstants.hxx> +#define MANIFEST_NSPREFIX "manifest:" #define ELEMENT_MANIFEST "manifest:manifest" #define ATTRIBUTE_XMLNS "xmlns:manifest" #define MANIFEST_NAMESPACE "http://openoffice.org/2001/manifest" diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index 44b451b1361d..5a7f1788d632 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -19,7 +19,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). + * ( a copy is included in the LICENSE file that accompanied this code ). * * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see @@ -28,7 +28,7 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove +// MARKER( update_precomp.py ): autogen include statement, do not remove #include "precompiled_package.hxx" #include <ManifestImport.hxx> #include <ManifestDefines.hxx> @@ -44,8 +44,9 @@ using namespace com::sun::star; using namespace rtl; using namespace std; +// --------------------------------------------------- ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector ) -: nNumProperty (0) +: nNumProperty ( 0 ) , bIgnoreEncryptData ( sal_False ) , rManVector ( rNewManVector ) @@ -82,41 +83,52 @@ ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManV , sPBKDF2 ( RTL_CONSTASCII_USTRINGPARAM ( "PBKDF2" ) ) , sChecksumType ( RTL_CONSTASCII_USTRINGPARAM ( CHECKSUM_TYPE ) ) { + aStack.reserve( 10 ); } -ManifestImport::~ManifestImport (void ) + +// --------------------------------------------------- +ManifestImport::~ManifestImport ( void ) { } + +// --------------------------------------------------- void SAL_CALL ManifestImport::startDocument( ) - throw(xml::sax::SAXException, uno::RuntimeException) + throw( xml::sax::SAXException, uno::RuntimeException ) { } + +// --------------------------------------------------- void SAL_CALL ManifestImport::endDocument( ) - throw(xml::sax::SAXException, uno::RuntimeException) + throw( xml::sax::SAXException, uno::RuntimeException ) { } + +// --------------------------------------------------- void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs ) - throw(xml::sax::SAXException, uno::RuntimeException) + throw( xml::sax::SAXException, uno::RuntimeException ) { - if (aName == sFileEntryElement) + StringHashMap aConvertedAttribs; + ::rtl::OUString aConvertedName = PushNameAndNamespaces( aName, xAttribs, aConvertedAttribs ); + + if ( aConvertedName == sFileEntryElement ) { - aStack.push( e_FileEntry ); aSequence.realloc ( PKG_SIZE_ENCR_MNFST ); // Put full-path property first for MBA aSequence[nNumProperty].Name = sFullPathProperty; - aSequence[nNumProperty++].Value <<= xAttribs->getValueByName( sFullPathAttribute ); + aSequence[nNumProperty++].Value <<= aConvertedAttribs[sFullPathAttribute]; aSequence[nNumProperty].Name = sMediaTypeProperty; - aSequence[nNumProperty++].Value <<= xAttribs->getValueByName( sMediaTypeAttribute ); + aSequence[nNumProperty++].Value <<= aConvertedAttribs[sMediaTypeAttribute]; - OUString sVersion = xAttribs->getValueByName ( sVersionAttribute ); + OUString sVersion = aConvertedAttribs[sVersionAttribute]; if ( sVersion.getLength() ) { aSequence[nNumProperty].Name = sVersionProperty; aSequence[nNumProperty++].Value <<= sVersion; } - OUString sSize = xAttribs->getValueByName ( sSizeAttribute ); - if (sSize.getLength()) + OUString sSize = aConvertedAttribs[sSizeAttribute]; + if ( sSize.getLength() ) { sal_Int32 nSize; nSize = sSize.toInt32(); @@ -124,92 +136,200 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re aSequence[nNumProperty++].Value <<= nSize; } } - else if (!aStack.empty()) + else if ( aStack.size() > 1 ) { - if (aStack.top() == e_FileEntry && aName == sEncryptionDataElement) + ManifestStack::reverse_iterator aIter = aStack.rbegin(); + aIter++; + + if ( aIter->m_aConvertedName.equals( sFileEntryElement ) ) { - // If this element exists, then this stream is encrypted and we need - // to store the initialisation vector, salt and iteration count used - aStack.push (e_EncryptionData ); - OUString aString = xAttribs->getValueByName ( sChecksumTypeAttribute ); - if (aString == sChecksumType && !bIgnoreEncryptData) + if ( aConvertedName.equals( sEncryptionDataElement ) ) { - aString = xAttribs->getValueByName ( sChecksumAttribute ); - Sequence < sal_uInt8 > aDecodeBuffer; - Base64Codec::decodeBase64 (aDecodeBuffer, aString); - aSequence[nNumProperty].Name = sDigestProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; + // If this element exists, then this stream is encrypted and we need + // to store the initialisation vector, salt and iteration count used + OUString aString = aConvertedAttribs[sChecksumTypeAttribute]; + if ( aString == sChecksumType && !bIgnoreEncryptData ) + { + aString = aConvertedAttribs[sChecksumAttribute]; + Sequence < sal_uInt8 > aDecodeBuffer; + Base64Codec::decodeBase64 ( aDecodeBuffer, aString ); + aSequence[nNumProperty].Name = sDigestProperty; + aSequence[nNumProperty++].Value <<= aDecodeBuffer; + } } } - else if (aStack.top() == e_EncryptionData && aName == sAlgorithmElement) + else if ( aIter->m_aConvertedName.equals( sEncryptionDataElement ) ) { - aStack.push (e_Algorithm); - OUString aString = xAttribs->getValueByName ( sAlgorithmNameAttribute ); - if (aString == sBlowfish && !bIgnoreEncryptData) + if ( aConvertedName == sAlgorithmElement ) { - aString = xAttribs->getValueByName ( sInitialisationVectorAttribute ); - Sequence < sal_uInt8 > aDecodeBuffer; - Base64Codec::decodeBase64 (aDecodeBuffer, aString); - aSequence[nNumProperty].Name = sInitialisationVectorProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; + OUString aString = aConvertedAttribs[sAlgorithmNameAttribute]; + if ( aString == sBlowfish && !bIgnoreEncryptData ) + { + aString = aConvertedAttribs[sInitialisationVectorAttribute]; + Sequence < sal_uInt8 > aDecodeBuffer; + Base64Codec::decodeBase64 ( aDecodeBuffer, aString ); + aSequence[nNumProperty].Name = sInitialisationVectorProperty; + aSequence[nNumProperty++].Value <<= aDecodeBuffer; + } + else + // If we don't recognise the algorithm, then the key derivation info + // is useless to us + bIgnoreEncryptData = sal_True; } - else - // If we don't recognise the algorithm, then the key derivation info - // is useless to us - bIgnoreEncryptData = sal_True; - } - else if (aStack.top() == e_EncryptionData && aName == sKeyDerivationElement) - { - aStack.push (e_KeyDerivation); - OUString aString = xAttribs->getValueByName ( sKeyDerivationNameAttribute ); - if ( aString == sPBKDF2 && !bIgnoreEncryptData ) + else if ( aConvertedName == sKeyDerivationElement ) { - aString = xAttribs->getValueByName ( sSaltAttribute ); - Sequence < sal_uInt8 > aDecodeBuffer; - Base64Codec::decodeBase64 (aDecodeBuffer, aString); - aSequence[nNumProperty].Name = sSaltProperty; - aSequence[nNumProperty++].Value <<= aDecodeBuffer; - - aString = xAttribs->getValueByName ( sIterationCountAttribute ); - aSequence[nNumProperty].Name = sIterationCountProperty; - aSequence[nNumProperty++].Value <<= aString.toInt32(); + OUString aString = aConvertedAttribs[sKeyDerivationNameAttribute]; + if ( aString == sPBKDF2 && !bIgnoreEncryptData ) + { + aString = aConvertedAttribs[sSaltAttribute]; + Sequence < sal_uInt8 > aDecodeBuffer; + Base64Codec::decodeBase64 ( aDecodeBuffer, aString ); + aSequence[nNumProperty].Name = sSaltProperty; + aSequence[nNumProperty++].Value <<= aDecodeBuffer; + + aString = aConvertedAttribs[sIterationCountAttribute]; + aSequence[nNumProperty].Name = sIterationCountProperty; + aSequence[nNumProperty++].Value <<= aString.toInt32(); + } + else + // If we don't recognise the key derivation technique, then the + // algorithm info is useless to us + bIgnoreEncryptData = sal_True; } - else - // If we don't recognise the key derivation technique, then the - // algorithm info is useless to us - bIgnoreEncryptData = sal_True; } } } -void SAL_CALL ManifestImport::endElement( const OUString& /*aName*/ ) - throw(xml::sax::SAXException, uno::RuntimeException) + +// --------------------------------------------------- +void SAL_CALL ManifestImport::endElement( const OUString& aName ) + throw( xml::sax::SAXException, uno::RuntimeException ) { - if ( !aStack.empty() ) + ::rtl::OUString aConvertedName = ConvertName( aName ); + if ( !aStack.empty() && aStack.rbegin()->m_aConvertedName.equals( aConvertedName ) ) { - if (aStack.top() == e_FileEntry) + if ( aConvertedName.equals( sFileEntryElement ) ) { aSequence.realloc ( nNumProperty ); bIgnoreEncryptData = sal_False; rManVector.push_back ( aSequence ); nNumProperty = 0; } - aStack.pop(); + + aStack.pop_back(); } } + +// --------------------------------------------------- void SAL_CALL ManifestImport::characters( const OUString& /*aChars*/ ) - throw(xml::sax::SAXException, uno::RuntimeException) + throw( xml::sax::SAXException, uno::RuntimeException ) { } + +// --------------------------------------------------- void SAL_CALL ManifestImport::ignorableWhitespace( const OUString& /*aWhitespaces*/ ) - throw(xml::sax::SAXException, uno::RuntimeException) + throw( xml::sax::SAXException, uno::RuntimeException ) { } + +// --------------------------------------------------- void SAL_CALL ManifestImport::processingInstruction( const OUString& /*aTarget*/, const OUString& /*aData*/ ) - throw(xml::sax::SAXException, uno::RuntimeException) + throw( xml::sax::SAXException, uno::RuntimeException ) { } + +// --------------------------------------------------- void SAL_CALL ManifestImport::setDocumentLocator( const uno::Reference< xml::sax::XLocator >& /*xLocator*/ ) - throw(xml::sax::SAXException, uno::RuntimeException) + throw( xml::sax::SAXException, uno::RuntimeException ) { } +// --------------------------------------------------- +::rtl::OUString ManifestImport::PushNameAndNamespaces( const ::rtl::OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs, StringHashMap& o_aConvertedAttribs ) +{ + StringHashMap aNamespaces; + ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > aAttribsStrs; + + if ( xAttribs.is() ) + { + sal_Int16 nAttrCount = xAttribs.is() ? xAttribs->getLength() : 0; + aAttribsStrs.reserve( nAttrCount ); + + for( sal_Int16 nInd = 0; nInd < nAttrCount; nInd++ ) + { + ::rtl::OUString aAttrName = xAttribs->getNameByIndex( nInd ); + ::rtl::OUString aAttrValue = xAttribs->getValueByIndex( nInd ); + if ( aAttrName.getLength() >= 5 + && aAttrName.compareToAscii( "xmlns", 5 ) == 0 + && ( aAttrName.getLength() == 5 || aAttrName.getStr()[5] == ( sal_Unicode )':' ) ) + { + // this is a namespace declaration + ::rtl::OUString aNsName( ( aAttrName.getLength() == 5 ) ? ::rtl::OUString() : aAttrName.copy( 6 ) ); + aNamespaces[aNsName] = aAttrValue; + } + else + { + // this is no namespace declaration + aAttribsStrs.push_back( pair< ::rtl::OUString, ::rtl::OUString >( aAttrName, aAttrValue ) ); + } + } + } + + ::rtl::OUString aConvertedName = ConvertNameWithNamespace( aName, aNamespaces ); + if ( !aConvertedName.getLength() ) + aConvertedName = ConvertName( aName ); + + aStack.push_back( ManifestScopeEntry( aConvertedName, aNamespaces ) ); + + for ( sal_uInt16 nInd = 0; nInd < aAttribsStrs.size(); nInd++ ) + { + // convert the attribute names on filling + o_aConvertedAttribs[ConvertName( aAttribsStrs[nInd].first )] = aAttribsStrs[nInd].second; + } + + return aConvertedName; +} + +// --------------------------------------------------- +::rtl::OUString ManifestImport::ConvertNameWithNamespace( const ::rtl::OUString& aName, const StringHashMap& aNamespaces ) +{ + ::rtl::OUString aNsAlias; + ::rtl::OUString aPureName = aName; + + sal_Int32 nInd = aName.indexOf( ( sal_Unicode )':' ); + if ( nInd != -1 && nInd < aName.getLength() ) + { + aNsAlias = aName.copy( 0, nInd ); + aPureName = aName.copy( nInd + 1 ); + } + + ::rtl::OUString aResult; + + StringHashMap::const_iterator aIter = aNamespaces.find( aNsAlias ); + if ( aIter != aNamespaces.end() + && ( aIter->second.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MANIFEST_NAMESPACE ) ) ) + || aIter->second.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MANIFEST_OASIS_NAMESPACE ) ) ) ) ) + { + // no check for manifest.xml consistency currently since the old versions have supported inconsistent documents as well + aResult = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MANIFEST_NSPREFIX ) ); + aResult += aPureName; + } + + return aResult; +} + +// --------------------------------------------------- +::rtl::OUString ManifestImport::ConvertName( const ::rtl::OUString& aName ) +{ + ::rtl::OUString aConvertedName; + for ( ManifestStack::reverse_iterator aIter = aStack.rbegin(); !aConvertedName.getLength() && aIter != aStack.rend(); aIter++ ) + { + if ( !aIter->m_aNamespaces.empty() ) + aConvertedName = ConvertNameWithNamespace( aName, aIter->m_aNamespaces ); + } + + if ( !aConvertedName.getLength() ) + aConvertedName = aName; + + return aConvertedName; +} + diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx index f669896aacd6..b07e4070a425 100644 --- a/package/source/manifest/ManifestImport.hxx +++ b/package/source/manifest/ManifestImport.hxx @@ -36,27 +36,38 @@ #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #endif #include <vector> -#include <stack> + +#include <HashMaps.hxx> namespace com { namespace sun { namespace star { namespace xml { namespace sax { class XAttributeList; } } namespace beans { struct PropertyValue; } } } } -enum ElementNames +typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash, eqFunc > StringHashMap; + +struct ManifestScopeEntry { - e_Manifest, - e_FileEntry, - e_EncryptionData, - e_Algorithm, - e_KeyDerivation + ::rtl::OUString m_aConvertedName; + StringHashMap m_aNamespaces; + + ManifestScopeEntry( const ::rtl::OUString& aConvertedName, const StringHashMap& aNamespaces ) + : m_aConvertedName( aConvertedName ) + , m_aNamespaces( aNamespaces ) + {} + + ~ManifestScopeEntry() + {} }; + +typedef ::std::vector< ManifestScopeEntry > ManifestStack; + class ManifestImport : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler > { protected: com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aSequence; sal_Int16 nNumProperty; - ::std::stack < ElementNames > aStack; + ManifestStack aStack; sal_Bool bIgnoreEncryptData; ::std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rManVector; @@ -93,6 +104,13 @@ protected: const ::rtl::OUString sPBKDF2; const ::rtl::OUString sChecksumType; + + ::rtl::OUString PushNameAndNamespaces( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs, + StringHashMap& o_aConvertedAttribs ); + ::rtl::OUString ConvertNameWithNamespace( const ::rtl::OUString& aName, const StringHashMap& aNamespaces ); + ::rtl::OUString ConvertName( const ::rtl::OUString& aName ); + public: ManifestImport( std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rNewVector ); ~ManifestImport( void ); diff --git a/package/source/manifest/ManifestWriter.cxx b/package/source/manifest/ManifestWriter.cxx index 1428cec29c71..c4564fa7ff8b 100644 --- a/package/source/manifest/ManifestWriter.cxx +++ b/package/source/manifest/ManifestWriter.cxx @@ -49,7 +49,10 @@ #include <com/sun/star/xml/sax/SAXException.hpp> #endif +#include <osl/diagnose.hxx> + using namespace ::rtl; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::io; @@ -83,7 +86,7 @@ void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStr } catch( SAXException& ) { - throw RuntimeException(); + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } } } diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx index dac6c1ebee06..a75915dacfbe 100644 --- a/package/source/xstor/ocompinstream.cxx +++ b/package/source/xstor/ocompinstream.cxx @@ -132,10 +132,16 @@ sal_Int32 SAL_CALL OInputCompStream::readBytes( uno::Sequence< sal_Int8 >& aData { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xStream.is() ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No stream!" ) ) ); throw uno::RuntimeException(); + } return m_xStream->readBytes( aData, nBytesToRead ); } @@ -149,10 +155,16 @@ sal_Int32 SAL_CALL OInputCompStream::readSomeBytes( uno::Sequence< sal_Int8 >& a { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xStream.is() ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No stream!" ) ) ); throw uno::RuntimeException(); + } return m_xStream->readSomeBytes( aData, nMaxBytesToRead ); @@ -167,10 +179,16 @@ void SAL_CALL OInputCompStream::skipBytes( sal_Int32 nBytesToSkip ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xStream.is() ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No stream!" ) ) ); throw uno::RuntimeException(); + } m_xStream->skipBytes( nBytesToSkip ); @@ -184,10 +202,16 @@ sal_Int32 SAL_CALL OInputCompStream::available( ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xStream.is() ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No stream!" ) ) ); throw uno::RuntimeException(); + } return m_xStream->available(); @@ -208,7 +232,10 @@ uno::Reference< io::XInputStream > SAL_CALL OInputCompStream::getInputStream() { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xStream.is() ) return uno::Reference< io::XInputStream >(); @@ -222,7 +249,10 @@ uno::Reference< io::XOutputStream > SAL_CALL OInputCompStream::getOutputStream() { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } return uno::Reference< io::XOutputStream >(); } @@ -233,7 +263,10 @@ void OInputCompStream::InternalDispose() // can be called only by OWriteStream_Impl ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } // the source object is also a kind of locker for the current object // since the listeners could dispose the object while being notified @@ -259,7 +292,10 @@ void SAL_CALL OInputCompStream::dispose( ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pInterfaceContainer ) { @@ -284,7 +320,10 @@ void SAL_CALL OInputCompStream::addEventListener( const uno::Reference< lang::XE { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_pInterfaceContainer ) m_pInterfaceContainer = new ::cppu::OInterfaceContainerHelper( m_rMutexRef->GetMutex() ); @@ -298,7 +337,10 @@ void SAL_CALL OInputCompStream::removeEventListener( const uno::Reference< lang: { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pInterfaceContainer ) m_pInterfaceContainer->removeInterface( xListener ); @@ -312,7 +354,10 @@ sal_Bool SAL_CALL OInputCompStream::hasByID( const ::rtl::OUString& sID ) ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -337,7 +382,10 @@ sal_Bool SAL_CALL OInputCompStream::hasByID( const ::rtl::OUString& sID ) ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -359,7 +407,10 @@ sal_Bool SAL_CALL OInputCompStream::hasByID( const ::rtl::OUString& sID ) ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -381,7 +432,10 @@ uno::Sequence< beans::StringPair > SAL_CALL OInputCompStream::getRelationshipByI ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -408,7 +462,10 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::g ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -440,7 +497,10 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::g ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -468,7 +528,10 @@ void SAL_CALL OInputCompStream::insertRelationshipByID( const ::rtl::OUString& ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -485,7 +548,10 @@ void SAL_CALL OInputCompStream::removeRelationshipByID( const ::rtl::OUString& ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -502,7 +568,10 @@ void SAL_CALL OInputCompStream::insertRelationships( const uno::Sequence< uno:: ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -518,7 +587,10 @@ void SAL_CALL OInputCompStream::clearRelationships() ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -533,7 +605,10 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL OInputCompStream::getProperty ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } //TODO: return uno::Reference< beans::XPropertySetInfo >(); @@ -550,7 +625,10 @@ void SAL_CALL OInputCompStream::setPropertyValue( const ::rtl::OUString& aProper ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } // all the provided properties are accessible for ( sal_Int32 aInd = 0; aInd < m_aProperties.getLength(); aInd++ ) @@ -574,7 +652,10 @@ uno::Any SAL_CALL OInputCompStream::getPropertyValue( const ::rtl::OUString& aPr ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } ::rtl::OUString aPropertyName; if ( aProp.equalsAscii( "IsEncrypted" ) ) @@ -609,7 +690,10 @@ void SAL_CALL OInputCompStream::addPropertyChangeListener( ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } //TODO: } @@ -626,7 +710,10 @@ void SAL_CALL OInputCompStream::removePropertyChangeListener( ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } //TODO: } @@ -643,7 +730,10 @@ void SAL_CALL OInputCompStream::addVetoableChangeListener( ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } //TODO: } @@ -660,7 +750,10 @@ void SAL_CALL OInputCompStream::removeVetoableChangeListener( ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } //TODO: } diff --git a/package/source/xstor/oseekinstream.cxx b/package/source/xstor/oseekinstream.cxx index c7b071f44f47..6dd6ee4bea0a 100644 --- a/package/source/xstor/oseekinstream.cxx +++ b/package/source/xstor/oseekinstream.cxx @@ -127,10 +127,16 @@ void SAL_CALL OInputSeekStream::seek( sal_Int64 location ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xSeekable.is() ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No seekable!" ) ) ); throw uno::RuntimeException(); + } m_xSeekable->seek( location ); } @@ -141,10 +147,16 @@ sal_Int64 SAL_CALL OInputSeekStream::getPosition() { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xSeekable.is() ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No seekable!" ) ) ); throw uno::RuntimeException(); + } return m_xSeekable->getPosition(); } @@ -155,10 +167,16 @@ sal_Int64 SAL_CALL OInputSeekStream::getLength() { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( m_bDisposed ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xSeekable.is() ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No seekable!" ) ) ); throw uno::RuntimeException(); + } return m_xSeekable->getLength(); } diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 079b23d7c17a..45df6d306a8c 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -43,10 +43,8 @@ #include <cppuhelper/exc_hlp.hxx> #include <osl/diagnose.h> -#ifndef _COMPHELPER_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif - +#include <comphelper/componentcontext.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/ofopxmlhelper.hxx> @@ -64,6 +62,8 @@ using namespace ::com::sun::star; +namespace package +{ //----------------------------------------------- uno::Sequence< sal_Int8 > MakeKeyFromPass( ::rtl::OUString aPass, sal_Bool bUseUTF ) { @@ -94,6 +94,25 @@ uno::Sequence< sal_Int8 > MakeKeyFromPass( ::rtl::OUString aPass, sal_Bool bUseU namespace { //----------------------------------------------- +void StaticAddLog( const ::rtl::OUString& aMessage ) +{ + try + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + if ( aContext.is() ) + { + uno::Reference< logging::XSimpleLogRing > xLogRing( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), uno::UNO_QUERY_THROW ); + xLogRing->logString( aMessage ); + } + } + catch( uno::Exception& ) + { + // No log + } +} +} // namespace package + +//----------------------------------------------- void SetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySet >& xPropertySet, const uno::Sequence< sal_Int8 >& aKey ) { @@ -105,8 +124,10 @@ void SetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySet >& try { xPropertySet->setPropertyValue( aString_EncryptionKey, uno::makeAny( aKey ) ); } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + ::package::StaticAddLog( aException.Message ); + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't set encryption" ) ) ); OSL_ENSURE( sal_False, "Can't write encryption related properties!\n" ); throw io::IOException(); // TODO } @@ -123,8 +144,11 @@ uno::Any GetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySe try { return xPropertySet->getPropertyValue( aString_EncryptionKey ); } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + ::package::StaticAddLog( aException.Message ); + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't get encryption property" ) ) ); + OSL_ENSURE( sal_False, "Can't get encryption related properties!\n" ); throw io::IOException(); // TODO } @@ -164,8 +188,10 @@ sal_Bool KillFile( const ::rtl::OUString& aURL, const uno::Reference< lang::XMul bRet = sal_True; } } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + ::package::StaticAddLog( aException.Message ); + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); } return bRet; @@ -190,8 +216,10 @@ const sal_Int32 n_ConstBufferSize = 32000; uno::Any aUrl = xTempFile->getPropertyValue( ::rtl::OUString::createFromAscii( "Uri" ) ); aUrl >>= aTempURL; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + ::package::StaticAddLog( aException.Message ); + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); } if ( !aTempURL.getLength() ) @@ -289,6 +317,28 @@ void OWriteStream_Impl::CleanCacheStream() } //----------------------------------------------- +void OWriteStream_Impl::AddLog( const ::rtl::OUString& aMessage ) +{ + if ( !m_xLogRing.is() ) + { + try + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + if ( aContext.is() ) + m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), uno::UNO_QUERY_THROW ); + } + catch( uno::Exception& ) + { + // No log + } + } + + if ( m_xLogRing.is() ) + m_xLogRing->logString( aMessage ); +} + + +//----------------------------------------------- void OWriteStream_Impl::InsertIntoPackageFolder( const ::rtl::OUString& aName, const uno::Reference< container::XNameContainer >& xParentPackageFolder ) { @@ -428,8 +478,12 @@ void OWriteStream_Impl::DisposeWrappers() try { m_pAntiImpl->dispose(); } - catch ( uno::RuntimeException& ) - {} + catch ( uno::RuntimeException& aRuntimeException ) + { + AddLog( aRuntimeException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + } + m_pAntiImpl = NULL; } m_pParent = NULL; @@ -477,7 +531,6 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor if ( !xTempAccess.is() ) throw uno::RuntimeException(); // TODO: - uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( aTempURL ); if ( xTempOutStream.is() ) { @@ -490,14 +543,21 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor throw io::IOException(); // TODO: } } - catch( packages::WrongPasswordException& ) + catch( packages::WrongPasswordException& aWrongPasswordException ) { + AddLog( aWrongPasswordException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + KillFile( aTempURL, GetServiceFactory() ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + KillFile( aTempURL, GetServiceFactory() ); + throw; } if ( aTempURL.getLength() ) @@ -618,8 +678,10 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetTempFileAsStream() { xTempStream = xTempAccess->openFileReadWrite( m_aTempURL ); } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); } } } @@ -663,6 +725,8 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetTempFileAsInputStream() } catch( uno::Exception& ) { + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); } } } @@ -702,6 +766,9 @@ void OWriteStream_Impl::CopyTempFileToOutput( uno::Reference< io::XOutputStream } catch( uno::Exception& ) { + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + m_xCacheSeek->seek( nPos ); throw io::IOException(); //TODO: } @@ -724,6 +791,8 @@ void OWriteStream_Impl::CopyTempFileToOutput( uno::Reference< io::XOutputStream } catch( uno::Exception& ) { + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); } if ( !xTempInStream.is() ) @@ -1077,8 +1146,11 @@ void OWriteStream_Impl::ReadRelInfoIfNecessary() m_xOrigRelInfoStream = uno::Reference< io::XInputStream >(); m_nRelInfoStatus = RELINFO_READ; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + m_nRelInfoStatus = RELINFO_BROKEN; m_bOrigRelInfoBroken = sal_True; } @@ -1144,8 +1216,11 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::ReadPackageStreamProper try { aResult[nInd].Value = xPropSet->getPropertyValue( aResult[nInd].Name ); } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + OSL_ENSURE( sal_False, "A property can't be retrieved!\n" ); } } @@ -1285,22 +1360,29 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod m_pParent->m_bIsModified = sal_True; } } - catch( packages::WrongPasswordException& ) + catch( packages::WrongPasswordException& aWrongPasswordException ) { SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); + AddLog( aWrongPasswordException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + OSL_ENSURE( sal_False, "Can't write encryption related properties!\n" ); SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); throw io::IOException(); // TODO: } } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } @@ -1330,8 +1412,11 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod { aGlobalPass = GetCommonRootPass(); } - catch( packages::NoEncryptionException& ) + catch( packages::NoEncryptionException& aNoEncryptionException ) { + AddLog( aNoEncryptionException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw packages::WrongPasswordException(); } @@ -1564,8 +1649,11 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar { aGlobalPass = GetCommonRootPass(); } - catch( packages::NoEncryptionException& ) + catch( packages::NoEncryptionException& aNoEncryptionException ) { + AddLog( aNoEncryptionException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No Element" ) ) ); + throw packages::WrongPasswordException(); } @@ -1634,7 +1722,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); } } - catch( packages::WrongPasswordException& ) + catch( packages::WrongPasswordException& aWrongPasswordException ) { SetEncryptionKeyProperty_Impl( xPropertySet, MakeKeyFromPass( aPass, sal_False ) ); try { @@ -1644,19 +1732,25 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar { OSL_ENSURE( sal_False, "Encrypted ZipStream must already have input stream inside!\n" ); SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); + AddLog( aWrongPasswordException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { OSL_ENSURE( sal_False, "Can't open encrypted stream!\n" ); SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() ); + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } @@ -1830,8 +1924,11 @@ OWriteStream::~OWriteStream() try { dispose(); } - catch( uno::RuntimeException& ) - {} + catch( uno::RuntimeException& aRuntimeException ) + { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + } } } @@ -1861,7 +1958,10 @@ void OWriteStream::DeInit() void OWriteStream::CheckInitOnDemand() { if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_bInitOnDemand ) { @@ -1920,8 +2020,11 @@ void OWriteStream::CopyToStreamInternally_Impl( const uno::Reference< io::XStrea try { m_xSeekable->seek( nCurPos ); } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + // TODO: set the stoream in invalid state or dispose OSL_ENSURE( sal_False, "The stream become invalid during copiing!\n" ); throw uno::RuntimeException(); @@ -2167,7 +2270,10 @@ sal_Int32 SAL_CALL OWriteStream::readBytes( uno::Sequence< sal_Int8 >& aData, sa CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xInStream.is() ) throw io::NotConnectedException(); @@ -2187,7 +2293,10 @@ sal_Int32 SAL_CALL OWriteStream::readSomeBytes( uno::Sequence< sal_Int8 >& aData CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xInStream.is() ) throw io::NotConnectedException(); @@ -2207,7 +2316,10 @@ void SAL_CALL OWriteStream::skipBytes( sal_Int32 nBytesToSkip ) CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xInStream.is() ) throw io::NotConnectedException(); @@ -2226,7 +2338,10 @@ sal_Int32 SAL_CALL OWriteStream::available( ) CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xInStream.is() ) throw io::NotConnectedException(); @@ -2244,7 +2359,10 @@ void SAL_CALL OWriteStream::closeInput( ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_bInitOnDemand && ( m_bInStreamDisconnected || !m_xInStream.is() ) ) throw io::NotConnectedException(); @@ -2266,7 +2384,10 @@ uno::Reference< io::XInputStream > SAL_CALL OWriteStream::getInputStream() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_bInitOnDemand && ( m_bInStreamDisconnected || !m_xInStream.is() ) ) return uno::Reference< io::XInputStream >(); @@ -2283,7 +2404,10 @@ uno::Reference< io::XOutputStream > SAL_CALL OWriteStream::getOutputStream() CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xOutStream.is() ) return uno::Reference< io::XOutputStream >(); @@ -2304,7 +2428,10 @@ void SAL_CALL OWriteStream::writeBytes( const uno::Sequence< sal_Int8 >& aData ) // NO CheckInitOnDemand()! if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_bInitOnDemand ) { @@ -2372,7 +2499,10 @@ void SAL_CALL OWriteStream::flush() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_bInitOnDemand ) { @@ -2419,7 +2549,10 @@ void SAL_CALL OWriteStream::closeOutput() CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xOutStream.is() ) throw io::NotConnectedException(); @@ -2441,7 +2574,10 @@ void SAL_CALL OWriteStream::seek( sal_Int64 location ) CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xSeekable.is() ) throw uno::RuntimeException(); @@ -2459,7 +2595,10 @@ sal_Int64 SAL_CALL OWriteStream::getPosition() CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xSeekable.is() ) throw uno::RuntimeException(); @@ -2477,7 +2616,10 @@ sal_Int64 SAL_CALL OWriteStream::getLength() CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xSeekable.is() ) throw uno::RuntimeException(); @@ -2495,7 +2637,10 @@ void SAL_CALL OWriteStream::truncate() CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_xOutStream.is() ) throw uno::RuntimeException(); @@ -2524,7 +2669,10 @@ void SAL_CALL OWriteStream::dispose() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_xOutStream.is() ) CloseOutput_Impl(); @@ -2551,8 +2699,11 @@ void SAL_CALL OWriteStream::dispose() m_pImpl->Revert(); } } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not commit/revert the storage!\n" ), @@ -2581,7 +2732,10 @@ void SAL_CALL OWriteStream::addEventListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } m_pData->m_aListenersContainer.addInterface( ::getCppuType((const uno::Reference< lang::XEventListener >*)0), xListener ); @@ -2595,7 +2749,10 @@ void SAL_CALL OWriteStream::removeEventListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } m_pData->m_aListenersContainer.removeInterface( ::getCppuType((const uno::Reference< lang::XEventListener >*)0), xListener ); @@ -2611,7 +2768,10 @@ void SAL_CALL OWriteStream::setEncryptionPassword( const ::rtl::OUString& aPass CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } OSL_ENSURE( m_pImpl->m_xPackageStream.is(), "No package stream is set!\n" ); @@ -2630,7 +2790,10 @@ void SAL_CALL OWriteStream::removeEncryption() CheckInitOnDemand(); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } OSL_ENSURE( m_pImpl->m_xPackageStream.is(), "No package stream is set!\n" ); @@ -2647,7 +2810,10 @@ sal_Bool SAL_CALL OWriteStream::hasByID( const ::rtl::OUString& sID ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -2657,8 +2823,11 @@ sal_Bool SAL_CALL OWriteStream::hasByID( const ::rtl::OUString& sID ) getRelationshipByID( sID ); return sal_True; } - catch( container::NoSuchElementException& ) - {} + catch( container::NoSuchElementException& aNoSuchElementException ) + { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No Element" ) ) ); + } return sal_False; } @@ -2672,7 +2841,10 @@ sal_Bool SAL_CALL OWriteStream::hasByID( const ::rtl::OUString& sID ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -2694,7 +2866,10 @@ sal_Bool SAL_CALL OWriteStream::hasByID( const ::rtl::OUString& sID ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -2716,7 +2891,10 @@ uno::Sequence< beans::StringPair > SAL_CALL OWriteStream::getRelationshipByID( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -2743,7 +2921,10 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OWriteStream::getRe ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -2775,7 +2956,10 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OWriteStream::getAl ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -2792,7 +2976,10 @@ void SAL_CALL OWriteStream::insertRelationshipByID( const ::rtl::OUString& sID, ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -2854,7 +3041,10 @@ void SAL_CALL OWriteStream::removeRelationshipByID( const ::rtl::OUString& sID ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -2893,7 +3083,10 @@ void SAL_CALL OWriteStream::insertRelationships( const uno::Sequence< uno::Sequ ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -2972,7 +3165,10 @@ void SAL_CALL OWriteStream::clearRelationships() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) throw uno::RuntimeException(); @@ -3003,7 +3199,10 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } m_pImpl->GetStreamProperties(); ::rtl::OUString aCompressedString( RTL_CONSTASCII_USTRINGPARAM( "Compressed" ) ); @@ -3126,7 +3325,10 @@ uno::Any SAL_CALL OWriteStream::getPropertyValue( const ::rtl::OUString& aProp ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( aProp.equalsAscii( "RelId" ) ) { @@ -3180,7 +3382,10 @@ void SAL_CALL OWriteStream::addPropertyChangeListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } //TODO: } @@ -3197,7 +3402,10 @@ void SAL_CALL OWriteStream::removePropertyChangeListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } //TODO: } @@ -3214,7 +3422,10 @@ void SAL_CALL OWriteStream::addVetoableChangeListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } //TODO: } @@ -3231,7 +3442,10 @@ void SAL_CALL OWriteStream::removeVetoableChangeListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } //TODO: } @@ -3251,7 +3465,10 @@ void OWriteStream::BroadcastTransaction( sal_Int8 nMessage ) { // no need to lock mutex here for the checking of m_pImpl, and m_pData is alive until the object is destructed if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) ); @@ -3292,7 +3509,10 @@ void SAL_CALL OWriteStream::commit() RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OWriteStream::commit" ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_bTransacted ) throw uno::RuntimeException(); @@ -3303,27 +3523,39 @@ void SAL_CALL OWriteStream::commit() ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } m_pImpl->Commit(); // when the storage is commited the parent is modified ModifyParentUnlockMutex_Impl( aGuard ); } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Problems on commit!" ), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ), @@ -3344,7 +3576,10 @@ void SAL_CALL OWriteStream::revert() // the method removes all the changes done after last commit if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_bTransacted ) throw uno::RuntimeException(); @@ -3354,25 +3589,37 @@ void SAL_CALL OWriteStream::revert() ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } try { m_pImpl->Revert(); } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Problems on revert!" ), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ), @@ -3395,7 +3642,10 @@ void SAL_CALL OWriteStream::addTransactionListener( const uno::Reference< embed: ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_bTransacted ) throw uno::RuntimeException(); @@ -3411,7 +3661,10 @@ void SAL_CALL OWriteStream::removeTransactionListener( const uno::Reference< emb ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); throw lang::DisposedException(); + } if ( !m_bTransacted ) throw uno::RuntimeException(); diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index a3ee6d91862e..cc0d0731e3a5 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -49,6 +49,7 @@ #include <com/sun/star/embed/XTransactionBroadcaster.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/beans/StringPair.hpp> +#include <com/sun/star/logging/XSimpleLogRing.hpp> #include <cppuhelper/implbase1.hxx> @@ -75,6 +76,10 @@ namespace cppu { class OTypeCollection; } +namespace package { + void StaticAddLog( const ::rtl::OUString& aMessage ); +} + struct WSInternalData_Impl { SotMutexHolderRef m_rSharedMutexRef; @@ -114,6 +119,7 @@ struct OWriteStream_Impl : public PreCreationStruct sal_Bool m_bFlushed; // sending the streams is coordinated by the root storage of the package ::com::sun::star::uno::Reference< ::com::sun::star::packages::XDataSinkEncrSupport > m_xPackageStream; + ::com::sun::star::uno::Reference< ::com::sun::star::logging::XSimpleLogRing > m_xLogRing; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; @@ -182,6 +188,8 @@ public: void CleanCacheStream(); + void AddLog( const ::rtl::OUString& aMessage ); + sal_Bool UsesCommonPass_Impl() { return m_bUseCommonPass; } sal_Bool HasTempFile_Impl() { return ( m_aTempURL.getLength() != 0 ); } sal_Bool IsTransacted(); diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 3705e560890c..a782780f13bc 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -48,11 +48,12 @@ #include <com/sun/star/beans/NamedValue.hpp> -#include <comphelper/processfactory.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/exc_hlp.hxx> #include <rtl/logfile.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/ofopxmlhelper.hxx> @@ -113,27 +114,27 @@ void OStorage_Impl::completeStorageStreamCopy_Impl( uno::Reference< beans::XPropertySet > xSourceProps( xSource, uno::UNO_QUERY ); uno::Reference< beans::XPropertySet > xDestProps( xDest, uno::UNO_QUERY ); if ( !xSourceProps.is() || !xDestProps.is() ) - throw uno::RuntimeException(); //TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< io::XOutputStream > xDestOutStream = xDest->getOutputStream(); if ( !xDestOutStream.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< io::XInputStream > xSourceInStream = xSource->getInputStream(); if ( !xSourceInStream.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: headers of encripted streams should be copied also ::comphelper::OStorageHelper::CopyInputToOutput( xSourceInStream, xDestOutStream ); uno::Sequence< ::rtl::OUString > aPropNames( 1 ); - aPropNames[0] = ::rtl::OUString::createFromAscii( "Compressed" ); + aPropNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Compressed" ) ); if ( nStorageType == PACKAGE_STORAGE ) { aPropNames.realloc( 3 ); - aPropNames[1] = ::rtl::OUString::createFromAscii( "MediaType" ); - aPropNames[2] = ::rtl::OUString::createFromAscii( "UseCommonStoragePasswordEncryption" ); + aPropNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); + aPropNames[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ); } else if ( nStorageType == OFOPXML_STORAGE ) { @@ -143,7 +144,7 @@ void OStorage_Impl::completeStorageStreamCopy_Impl( xRelAccess->insertRelationships( aRelInfo, sal_False ); aPropNames.realloc( 2 ); - aPropNames[1] = ::rtl::OUString::createFromAscii( "MediaType" ); + aPropNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); } for ( int ind = 0; ind < aPropNames.getLength(); ind++ ) @@ -154,12 +155,12 @@ uno::Reference< io::XInputStream > GetSeekableTempCopy( uno::Reference< io::XInp uno::Reference< lang::XMultiServiceFactory > xFactory ) { uno::Reference < io::XOutputStream > xTempOut( - xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + xFactory->createInstance ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ), uno::UNO_QUERY ); uno::Reference < io::XInputStream > xTempIn( xTempOut, uno::UNO_QUERY ); if ( !xTempOut.is() || !xTempIn.is() ) - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOut ); xTempOut->closeOutput(); @@ -320,8 +321,11 @@ OStorage_Impl::~OStorage_Impl() try { m_pAntiImpl->InternalDispose( sal_False ); } - catch ( uno::Exception& ) - {} + catch ( uno::Exception& aException ) + { + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + } m_pAntiImpl = NULL; } else if ( !m_aReadOnlyWrapList.empty() ) @@ -333,7 +337,11 @@ OStorage_Impl::~OStorage_Impl() if ( xTmp.is() ) try { pStorageIter->m_pPointer->InternalDispose( sal_False ); - } catch( uno::Exception& ) {} + } catch( uno::Exception& aException ) + { + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + } } m_aReadOnlyWrapList.clear(); @@ -363,7 +371,7 @@ OStorage_Impl::~OStorage_Impl() m_xPackageFolder = uno::Reference< container::XNameContainer >(); m_xPackage = uno::Reference< lang::XSingleServiceFactory >(); - ::rtl::OUString aPropertyName = ::rtl::OUString::createFromAscii( "URL" ); + ::rtl::OUString aPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); for ( sal_Int32 aInd = 0; aInd < m_xProperties.getLength(); aInd++ ) { if ( m_xProperties[aInd].Name.equals( aPropertyName ) ) @@ -390,10 +398,34 @@ OStorage_Impl::~OStorage_Impl() m_xStream = uno::Reference< io::XStream >(); } } - catch( uno::Exception& ) - {} + catch( uno::Exception& aException ) + { + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + AddLog( aException.Message ); + } + } + } +} + +//----------------------------------------------- +void OStorage_Impl::AddLog( const ::rtl::OUString& aMessage ) +{ + if ( !m_xLogRing.is() ) + { + try + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + if ( aContext.is() ) + m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), uno::UNO_QUERY_THROW ); + } + catch( uno::Exception& ) + { + // No log } } + + if ( m_xLogRing.is() ) + m_xLogRing->logString( aMessage ); } //----------------------------------------------- @@ -415,7 +447,11 @@ void OStorage_Impl::RemoveReadOnlyWrap( OStorage& aStorage ) { try { pStorageIter->m_pPointer->InternalDispose( sal_False ); - } catch( uno::Exception& ) {} + } catch( uno::Exception& aException ) + { + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + AddLog( aException.Message ); + } OStorageList_Impl::iterator pIterToDelete( pStorageIter ); pStorageIter++; @@ -491,7 +527,7 @@ void OStorage_Impl::OpenOwnPackage() m_xPackage = uno::Reference< lang::XSingleServiceFactory > ( GetServiceFactory()->createInstanceWithArguments( - ::rtl::OUString::createFromAscii( "com.sun.star.packages.comp.ZipPackage" ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.packages.comp.ZipPackage" ) ), aArguments ), uno::UNO_QUERY ); } @@ -501,14 +537,14 @@ void OStorage_Impl::OpenOwnPackage() if ( xHNameAccess.is() ) { - uno::Any aFolder = xHNameAccess->getByHierarchicalName( ::rtl::OUString::createFromAscii( "/" ) ); + uno::Any aFolder = xHNameAccess->getByHierarchicalName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) ); aFolder >>= m_xPackageFolder; } } OSL_ENSURE( m_xPackageFolder.is(), "The package root folder can not be opened!\n" ); if ( !m_xPackageFolder.is() ) - throw embed::InvalidStorageException(); // TODO + throw embed::InvalidStorageException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } //----------------------------------------------- @@ -606,11 +642,11 @@ void OStorage_Impl::ReadContents() uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xPackageFolder, uno::UNO_QUERY ); if ( !xEnumAccess.is() ) - throw uno::RuntimeException(); // TODO: + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration(); if ( !xEnum.is() ) - throw uno::RuntimeException(); // TODO: + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); m_bListCreated = sal_True; @@ -623,7 +659,7 @@ void OStorage_Impl::ReadContents() if ( !xNamed.is() ) { OSL_ENSURE( sal_False, "XNamed is not supported!\n" ); - throw uno::RuntimeException(); // TODO: + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } ::rtl::OUString aName = xNamed->getName(); @@ -635,7 +671,7 @@ void OStorage_Impl::ReadContents() if ( m_nStorageType == OFOPXML_STORAGE && aName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) { if ( !pNewElement->m_bIsStorage ) - throw io::IOException(); // TODO: Unexpected format + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: Unexpected format m_pRelStorElement = pNewElement; CreateRelStorage(); @@ -651,8 +687,11 @@ void OStorage_Impl::ReadContents() m_aChildrenList.push_back( pNewElement ); } } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + AddLog( aNoSuchElementException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "NoSuchElement" ) ) ); + OSL_ENSURE( sal_False, "hasMoreElements() implementation has problems!\n" ); break; } @@ -676,18 +715,18 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes uno::Reference< beans::XPropertySet > xPropSet( xDest, uno::UNO_QUERY ); if ( !xPropSet.is() ) - throw lang::IllegalArgumentException(); // TODO: + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); sal_Int32 nDestMode = embed::ElementModes::READ; - xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( "OpenMode" ) ) >>= nDestMode; + xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ) ) ) >>= nDestMode; if ( !( nDestMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); // TODO: access_denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access_denied ReadContents(); if ( !m_xPackageFolder.is() ) - throw embed::InvalidStorageException(); // TODO: + throw embed::InvalidStorageException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); for ( SotElementList_Impl::iterator pElementIter = m_aChildrenList.begin(); pElementIter != m_aChildrenList.end(); pElementIter++ ) @@ -699,8 +738,8 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes // move storage properties to the destination one ( means changeable properties ) if ( m_nStorageType == PACKAGE_STORAGE ) { - ::rtl::OUString aMediaTypeString = ::rtl::OUString::createFromAscii( "MediaType" ); - ::rtl::OUString aVersionString = ::rtl::OUString::createFromAscii( "Version" ); + ::rtl::OUString aMediaTypeString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); + ::rtl::OUString aVersionString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ); xPropSet->setPropertyValue( aMediaTypeString, uno::makeAny( m_aMediaType ) ); xPropSet->setPropertyValue( aVersionString, uno::makeAny( m_aVersion ) ); } @@ -709,7 +748,7 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes { // if this is a root storage, the common key from current one should be moved there sal_Bool bIsRoot = sal_False; - ::rtl::OUString aRootString = ::rtl::OUString::createFromAscii( "IsRoot" ); + ::rtl::OUString aRootString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsRoot" ) ); if ( ( xPropSet->getPropertyValue( aRootString ) >>= bIsRoot ) && bIsRoot ) { try @@ -719,8 +758,11 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes if ( xEncr.is() ) xEncr->setEncryptionPassword( aCommonPass ); } - catch( packages::NoEncryptionException& ) - {} + catch( packages::NoEncryptionException& aNoEncryptionException ) + { + AddLog( aNoEncryptionException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No Encryption" ) ) ); + } } } else if ( m_nStorageType == OFOPXML_STORAGE ) @@ -733,13 +775,13 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes // // Relations info stream is a writeonly property, introduced only to optimyze copying // // Should be used carefuly since no check for stream consistency is done, and the stream must not stay locked // - // ::rtl::OUString aRelInfoString = ::rtl::OUString::createFromAscii( "RelationsInfoStream" ); + // ::rtl::OUString aRelInfoString = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RelationsInfoStream" ) ); // xPropSet->setPropertyValue( aRelInfoString, uno::makeAny( GetSeekableTempCopy( xRelInfoStream, m_xFactory ) ) ); // } uno::Reference< embed::XRelationshipAccess > xRels( xDest, uno::UNO_QUERY ); if ( !xRels.is() ) - throw lang::IllegalArgumentException(); // TODO: + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); xRels->insertRelationships( GetAllRelationshipsIfAny(), sal_False ); } @@ -763,7 +805,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, uno::Reference< container::XNameAccess > xDestAccess( xDest, uno::UNO_QUERY ); if ( !xDestAccess.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( xDestAccess->hasByName( aName ) && !( pElement->m_bIsStorage && xDest->isStorageElement( aName ) ) ) @@ -781,7 +823,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, { OpenSubStorage( pElement, embed::ElementModes::READ ); if ( !pElement->m_pStorage ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } pElement->m_pStorage->CopyToStorage( xSubDest, bDirect ); @@ -792,7 +834,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, { OpenSubStream( pElement ); if ( !pElement->m_pStream ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } if ( !pElement->m_pStream->IsEncrypted() ) @@ -833,7 +875,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, uno::Reference< embed::XRelationshipAccess > xRels( xDest, uno::UNO_QUERY ); if ( !xRels.is() ) - throw lang::IllegalArgumentException(); // TODO: + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); xRels->insertRelationships( GetAllRelationshipsIfAny(), sal_False ); } @@ -857,7 +899,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, } if ( !xInputToInsert.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); xOptDest->insertStreamElementDirect( aName, xInputToInsert, aStrProps ); } @@ -874,7 +916,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, else if ( m_nStorageType != PACKAGE_STORAGE ) { OSL_ENSURE( sal_False, "Encryption is only supported in package storage!\n" ); - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } else if ( pElement->m_pStream->HasCachedPassword() && ( pElement->m_pStream->IsModified() || pElement->m_pStream->HasWriteOwner_Impl() ) ) @@ -886,8 +928,11 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, aCommonPass = GetCommonRootPass(); bHasCommonPass = sal_True; } - catch( packages::NoEncryptionException& ) - {} + catch( packages::NoEncryptionException& aNoEncryptionException ) + { + AddLog( aNoEncryptionException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No Encryption" ) ) ); + } if ( bHasCommonPass && pElement->m_pStream->GetCachedPassword().equals( aCommonPass ) ) { @@ -937,8 +982,11 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ), uno::Any( (sal_Bool) sal_True ) ); } - catch( packages::WrongPasswordException& ) + catch( packages::WrongPasswordException& aWrongPasswordException ) { + AddLog( aWrongPasswordException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Handled exception" ) ) ); + // If the common storage password does not allow to open the stream // it must be copyed in raw way uno::Reference< embed::XStorageRawAccess > xRawDest( xDest, uno::UNO_QUERY_THROW ); @@ -961,7 +1009,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > OStorage_Impl::GetAllRelatio || m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ || m_nRelInfoStatus == RELINFO_CHANGED ) return m_aRelInfo; else // m_nRelInfoStatus == RELINFO_CHANGED_BROKEN || m_nRelInfoStatus == RELINFO_BROKEN - throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Wrong relinfo stream!" ) ), + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong relinfo stream!" ) ), uno::Reference< uno::XInterface >() ); } @@ -972,7 +1020,7 @@ void OStorage_Impl::CopyLastCommitTo( const uno::Reference< embed::XStorage >& x OSL_ENSURE( m_xPackageFolder.is(), "A commited storage is incomplete!\n" ); if ( !m_xPackageFolder.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); OStorage_Impl aTempRepresent( NULL, embed::ElementModes::READ, @@ -994,7 +1042,7 @@ void OStorage_Impl::InsertIntoPackageFolder( const ::rtl::OUString& aName, OSL_ENSURE( m_xPackageFolder.is(), "An inserted storage is incomplete!\n" ); uno::Reference< lang::XUnoTunnel > xTunnel( m_xPackageFolder, uno::UNO_QUERY ); if ( !xTunnel.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); xParentPackageFolder->insertByName( aName, uno::makeAny( xTunnel ) ); @@ -1017,7 +1065,7 @@ void OStorage_Impl::Commit() // if storage is commited it should have a valid Package representation OSL_ENSURE( m_xPackageFolder.is(), "The package representation should exist!\n" ); if ( !m_xPackageFolder.is() ) - throw embed::InvalidStorageException(); // TODO: + throw embed::InvalidStorageException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); OSL_ENSURE( m_nStorageMode & embed::ElementModes::WRITE, "Commit of readonly storage, should be detected before!\n" ); @@ -1148,7 +1196,7 @@ void OStorage_Impl::Commit() { OpenSubStream( *pElementIter ); if ( !(*pElementIter)->m_pStream ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } CommitStreamRelInfo( *pElementIter ); @@ -1173,7 +1221,7 @@ void OStorage_Impl::Commit() { OSL_ENSURE( (*pElementIter)->m_pStorage, "An inserted storage is incomplete!\n" ); if ( !(*pElementIter)->m_pStorage ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); (*pElementIter)->m_pStorage->InsertIntoPackageFolder( (*pElementIter)->m_aName, xNewPackageFolder ); @@ -1184,7 +1232,7 @@ void OStorage_Impl::Commit() { OSL_ENSURE( (*pElementIter)->m_pStream, "An inserted stream is incomplete!\n" ); if ( !(*pElementIter)->m_pStream ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !(*pElementIter)->m_pStream->IsTransacted() ) (*pElementIter)->m_pStream->Commit(); @@ -1207,10 +1255,10 @@ void OStorage_Impl::Commit() // move properties to the destination package folder uno::Reference< beans::XPropertySet > xProps( xNewPackageFolder, uno::UNO_QUERY ); if ( !xProps.is() ) - throw uno::RuntimeException(); // TODO: + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - xProps->setPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ), uno::makeAny( m_aMediaType ) ); - xProps->setPropertyValue( ::rtl::OUString::createFromAscii( "Version" ), uno::makeAny( m_aVersion ) ); + xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ), uno::makeAny( m_aMediaType ) ); + xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), uno::makeAny( m_aVersion ) ); } if ( m_nStorageType == OFOPXML_STORAGE ) @@ -1222,7 +1270,7 @@ void OStorage_Impl::Commit() OSL_ENSURE( xChangesBatch.is(), "Impossible to commit package!\n" ); if ( !xChangesBatch.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); try { @@ -1239,6 +1287,8 @@ void OStorage_Impl::Commit() throw aException; } + AddLog( aException.Message ); + AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } } @@ -1321,19 +1371,19 @@ void OStorage_Impl::Revert() ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; if ( m_nStorageType != PACKAGE_STORAGE ) - throw packages::NoEncryptionException(); // TODO: + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( m_bIsRoot ) { if ( !m_bHasCommonPassword ) - throw packages::NoEncryptionException(); + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return m_aCommonPassword; } else { if ( !m_pParent ) - throw packages::NoEncryptionException(); + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return m_pParent->GetCommonRootPass(); } @@ -1363,7 +1413,7 @@ SotElement_Impl* OStorage_Impl::InsertStream( ::rtl::OUString aName, sal_Bool bE { OSL_ENSURE( m_xPackage.is(), "Not possible to refer to package as to factory!\n" ); if ( !m_xPackage.is() ) - throw embed::InvalidStorageException(); // TODO + throw embed::InvalidStorageException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< uno::Any > aSeq( 1 ); aSeq[0] <<= sal_False; @@ -1372,15 +1422,15 @@ SotElement_Impl* OStorage_Impl::InsertStream( ::rtl::OUString aName, sal_Bool bE OSL_ENSURE( xNewElement.is(), "Not possible to create a new stream!\n" ); if ( !xNewElement.is() ) - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< packages::XDataSinkEncrSupport > xPackageSubStream( xNewElement, uno::UNO_QUERY ); if ( !xPackageSubStream.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); OSL_ENSURE( m_nStorageType == PACKAGE_STORAGE || !bEncr, "Only package storage supports encryption!\n" ); if ( m_nStorageType != PACKAGE_STORAGE && bEncr ) - throw packages::NoEncryptionException(); // TODO + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the mode is not needed for storage stream internal implementation SotElement_Impl* pNewElement = InsertElement( aName, sal_False ); @@ -1399,10 +1449,10 @@ SotElement_Impl* OStorage_Impl::InsertRawStream( ::rtl::OUString aName, const un // insert of raw stream means insert and commit OSL_ENSURE( m_xPackage.is(), "Not possible to refer to package as to factory!\n" ); if ( !m_xPackage.is() ) - throw embed::InvalidStorageException(); // TODO + throw embed::InvalidStorageException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( m_nStorageType != PACKAGE_STORAGE ) - throw packages::NoEncryptionException(); // TODO + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< io::XSeekable > xSeek( xInStream, uno::UNO_QUERY ); uno::Reference< io::XInputStream > xInStrToInsert = xSeek.is() ? xInStream : @@ -1415,11 +1465,11 @@ SotElement_Impl* OStorage_Impl::InsertRawStream( ::rtl::OUString aName, const un OSL_ENSURE( xNewElement.is(), "Not possible to create a new stream!\n" ); if ( !xNewElement.is() ) - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< packages::XDataSinkEncrSupport > xPackageSubStream( xNewElement, uno::UNO_QUERY ); if ( !xPackageSubStream.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); xPackageSubStream->setRawStream( xInStrToInsert ); @@ -1441,7 +1491,7 @@ OStorage_Impl* OStorage_Impl::CreateNewStorageImpl( sal_Int32 nStorageMode ) { OSL_ENSURE( m_xPackage.is(), "Not possible to refer to package as to factory!\n" ); if ( !m_xPackage.is() ) - throw embed::InvalidStorageException(); // TODO + throw embed::InvalidStorageException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< uno::Any > aSeq( 1 ); aSeq[0] <<= sal_True; @@ -1450,11 +1500,11 @@ OStorage_Impl* OStorage_Impl::CreateNewStorageImpl( sal_Int32 nStorageMode ) OSL_ENSURE( xNewElement.is(), "Not possible to create a new storage!\n" ); if ( !xNewElement.is() ) - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< container::XNameContainer > xPackageSubFolder( xNewElement, uno::UNO_QUERY ); if ( !xPackageSubFolder.is() ) - throw uno::RuntimeException(); // TODO: + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); OStorage_Impl* pResult = new OStorage_Impl( this, nStorageMode, xPackageSubFolder, m_xPackage, m_xFactory, m_nStorageType ); @@ -1529,14 +1579,14 @@ void OStorage_Impl::OpenSubStorage( SotElement_Impl* pElement, sal_Int32 nStorag uno::Reference< lang::XUnoTunnel > xTunnel; m_xPackageFolder->getByName( pElement->m_aOriginalName ) >>= xTunnel; if ( !xTunnel.is() ) - throw container::NoSuchElementException(); // TODO: + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< container::XNameContainer > xPackageSubFolder( xTunnel, uno::UNO_QUERY ); OSL_ENSURE( xPackageSubFolder.is(), "Can not get XNameContainer interface from folder!\n" ); if ( !xPackageSubFolder.is() ) - throw uno::RuntimeException(); // TODO: + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); pElement->m_pStorage = new OStorage_Impl( this, nStorageMode, xPackageSubFolder, m_xPackage, m_xFactory, m_nStorageType ); } @@ -1557,11 +1607,11 @@ void OStorage_Impl::OpenSubStream( SotElement_Impl* pElement ) uno::Reference< lang::XUnoTunnel > xTunnel; m_xPackageFolder->getByName( pElement->m_aOriginalName ) >>= xTunnel; if ( !xTunnel.is() ) - throw container::NoSuchElementException(); // TODO: + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< packages::XDataSinkEncrSupport > xPackageSubStream( xTunnel, uno::UNO_QUERY ); if ( !xPackageSubStream.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the stream can never be inserted here, because inserted stream element holds the stream till commit or destruction pElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xFactory, sal_False, m_nStorageType, sal_False, GetRelInfoStreamForName( pElement->m_aOriginalName ) ); @@ -1600,7 +1650,7 @@ void OStorage_Impl::RemoveElement( SotElement_Impl* pElement ) if ( (pElement->m_pStorage && ( pElement->m_pStorage->m_pAntiImpl || !pElement->m_pStorage->m_aReadOnlyWrapList.empty() )) || (pElement->m_pStream && ( pElement->m_pStream->m_pAntiImpl || !pElement->m_pStream->m_aInputStreamsList.empty() )) ) - throw io::IOException(); // TODO: Access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: Access denied if ( pElement->m_bIsInserted ) { @@ -1648,10 +1698,10 @@ void OStorage_Impl::CloneStreamElement( const ::rtl::OUString& aStreamName, if ( !pElement ) { // element does not exist, throw exception - throw io::IOException(); // TODO: access_denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access_denied } else if ( pElement->m_bIsStorage ) - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !pElement->m_pStream ) OpenSubStream( pElement ); @@ -1673,7 +1723,7 @@ void OStorage_Impl::CloneStreamElement( const ::rtl::OUString& aStreamName, pElement->m_pStream->GetCopyOfLastCommit( xTargetStream ); } else - throw io::IOException(); // TODO: general_error + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: general_error } //----------------------------------------------- @@ -1712,7 +1762,7 @@ void OStorage_Impl::CreateRelStorage() OpenSubStorage( m_pRelStorElement, embed::ElementModes::WRITE ); if ( !m_pRelStorElement->m_pStorage ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); OStorage* pResultStorage = new OStorage( m_pRelStorElement->m_pStorage, sal_False ); m_xRelStorage = uno::Reference< embed::XStorage >( (embed::XStorage*) pResultStorage ); @@ -1726,7 +1776,7 @@ void OStorage_Impl::CommitStreamRelInfo( SotElement_Impl* pStreamElement ) // the stream element must be provided if ( !pStreamElement ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( m_nStorageType == OFOPXML_STORAGE && pStreamElement->m_pStream ) { @@ -1771,12 +1821,12 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain ::rtl::OUString aRelsStorName( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ); if ( !xNewPackageFolder.is() ) - throw uno::RuntimeException(); // TODO: + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( m_nStorageType == OFOPXML_STORAGE ) { if ( m_nRelInfoStatus == RELINFO_BROKEN || m_nRelInfoStatus == RELINFO_CHANGED_BROKEN ) - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( m_nRelInfoStatus == RELINFO_CHANGED || m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ @@ -1794,7 +1844,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain uno::Reference< io::XOutputStream > xOutStream = xRelsStream->getOutputStream(); if ( !xOutStream.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aRelInfo, m_xFactory ); @@ -1821,7 +1871,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain uno::Reference< io::XOutputStream > xOutputStream = xRelsStream->getOutputStream(); if ( !xOutputStream.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< io::XSeekable > xSeek( m_xNewRelInfoStream, uno::UNO_QUERY_THROW ); xSeek->seek( 0 ); @@ -1926,8 +1976,11 @@ OStorage::~OStorage() try { dispose(); } - catch( uno::RuntimeException& ) - {} + catch( uno::RuntimeException& aRuntimeException ) + { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Handled exception" ) ) ); + } } } @@ -1955,7 +2008,10 @@ void SAL_CALL OStorage::InternalDispose( sal_Bool bNotifyImpl ) RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::InternalDispose" ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } // the source object is also a kind of locker for the current object // since the listeners could dispose the object while being notified @@ -1986,7 +2042,11 @@ void SAL_CALL OStorage::InternalDispose( sal_Bool bNotifyImpl ) try { xTmp->dispose(); - } catch( uno::Exception& ) {} + } catch( uno::Exception& aException ) + { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + } } } @@ -2047,7 +2107,10 @@ void OStorage::BroadcastModifiedIfNecessary() { // no need to lock mutex here for the checking of m_pImpl, and m_pData is alive until the object is destructed if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !m_pImpl->m_bBroadcastModified ) return; @@ -2082,7 +2145,10 @@ void OStorage::BroadcastTransaction( sal_Int8 nMessage ) { // no need to lock mutex here for the checking of m_pImpl, and m_pData is alive until the object is destructed if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } OSL_ENSURE( !m_pData->m_bReadOnlyWrap, "The storage can not be modified at all!\n" ); @@ -2132,14 +2198,14 @@ SotElement_Impl* OStorage::OpenStreamElement_Impl( const ::rtl::OUString& aStrea if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) || (( nOpenMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE ) || ( nOpenMode & embed::ElementModes::NOCREATE ) == embed::ElementModes::NOCREATE ) - throw io::IOException(); // TODO: access_denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access_denied // create a new StreamElement and insert it into the list pElement = m_pImpl->InsertStream( aStreamName, bEncr ); } else if ( pElement->m_bIsStorage ) { - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } OSL_ENSURE( pElement, "In case element can not be created an exception must be thrown!" ); @@ -2148,7 +2214,7 @@ SotElement_Impl* OStorage::OpenStreamElement_Impl( const ::rtl::OUString& aStrea m_pImpl->OpenSubStream( pElement ); if ( !pElement->m_pStream ) - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return pElement; } @@ -2157,7 +2223,7 @@ SotElement_Impl* OStorage::OpenStreamElement_Impl( const ::rtl::OUString& aStrea void OStorage::MakeLinkToSubComponent_Impl( const uno::Reference< lang::XComponent >& xComponent ) { if ( !xComponent.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !m_pData->m_pSubElDispListener ) { @@ -2346,38 +2412,54 @@ void SAL_CALL OStorage::copyToStorage( const uno::Reference< embed::XStorage >& ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject*> ( this ), uno::UNO_QUERY ) ) - throw lang::IllegalArgumentException(); // TODO: + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); try { m_pImpl->CopyToStorage( xDest, sal_False ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy storage!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't copy storage!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -2398,17 +2480,20 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openStreamElement( ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aStreamName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable element name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable element name if ( ( nOpenMode & embed::ElementModes::WRITE ) && m_pData->m_bReadOnlyWrap ) - throw io::IOException(); // TODO: access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied uno::Reference< io::XStream > xResult; try @@ -2424,39 +2509,54 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openStreamElement( // before the storage disposes the stream it must deregister itself as listener uno::Reference< lang::XComponent > xStreamComponent( xResult, uno::UNO_QUERY ); if ( !xStreamComponent.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); MakeLinkToSubComponent_Impl( xStreamComponent ); } } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( packages::WrongPasswordException& ) + catch( packages::WrongPasswordException& aWrongPasswordException ) { + m_pImpl->AddLog( aWrongPasswordException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't open stream element!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't open stream element!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -2484,16 +2584,19 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openEncryptedStreamElement( ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) - packages::NoEncryptionException(); // TODO: + packages::NoEncryptionException(); if ( ( nOpenMode & embed::ElementModes::WRITE ) && m_pData->m_bReadOnlyWrap ) - throw io::IOException(); // TODO: access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied if ( !aPass.getLength() ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 3 ); uno::Reference< io::XStream > xResult; try @@ -2509,43 +2612,60 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openEncryptedStreamElement( // before the storage disposes the stream it must deregister itself as listener uno::Reference< lang::XComponent > xStreamComponent( xResult, uno::UNO_QUERY ); if ( !xStreamComponent.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); MakeLinkToSubComponent_Impl( xStreamComponent ); } } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( packages::NoEncryptionException& ) + catch( packages::NoEncryptionException& aNoEncryptionException ) { + m_pImpl->AddLog( aNoEncryptionException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( packages::WrongPasswordException& ) + catch( packages::WrongPasswordException& aWrongPasswordException ) { + m_pImpl->AddLog( aWrongPasswordException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't open encrypted stream stream!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't open encrypted stream stream!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -2571,21 +2691,24 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aStorName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aStorName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable storage name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name if ( ( nStorageMode & embed::ElementModes::WRITE ) && m_pData->m_bReadOnlyWrap ) - throw io::IOException(); // TODO: access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied if ( ( nStorageMode & embed::ElementModes::TRUNCATE ) && !( nStorageMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); // TODO: access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied // it's allways possible to read written storage in this implementation nStorageMode |= embed::ElementModes::READ; @@ -2600,26 +2723,26 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) || (( nStorageMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE ) || ( nStorageMode & embed::ElementModes::NOCREATE ) == embed::ElementModes::NOCREATE ) - throw io::IOException(); // TODO: access_denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access_denied // create a new StorageElement and insert it into the list pElement = m_pImpl->InsertStorage( aStorName, nStorageMode ); } else if ( !pElement->m_bIsStorage ) { - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } else if ( pElement->m_pStorage ) { // storage has already been opened; it may be opened another time, if it the mode allows to do so if ( pElement->m_pStorage->m_pAntiImpl ) { - throw io::IOException(); // TODO: access_denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access_denied } else if ( !pElement->m_pStorage->m_aReadOnlyWrapList.empty() && ( nStorageMode & embed::ElementModes::WRITE ) ) { - throw io::IOException(); // TODO: access_denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access_denied } else { @@ -2646,7 +2769,7 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( m_pImpl->OpenSubStorage( pElement, nStorageMode ); if ( !pElement->m_pStorage ) - throw io::IOException(); // TODO: general_error + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: general_error sal_Bool bReadOnlyWrap = ( ( nStorageMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE ); OStorage* pResultStorage = new OStorage( pElement->m_pStorage, bReadOnlyWrap ); @@ -2660,35 +2783,48 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( // before the storage disposes the stream it must deregister itself as listener uno::Reference< lang::XComponent > xStorageComponent( xResult, uno::UNO_QUERY ); if ( !xStorageComponent.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); MakeLinkToSubComponent_Impl( xStorageComponent ); } } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't open storage!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't open storage!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -2710,51 +2846,69 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneStreamElement( const ::rtl ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aStreamName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable storage name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name try { uno::Reference< io::XStream > xResult; m_pImpl->CloneStreamElement( aStreamName, sal_False, ::rtl::OUString(), xResult ); if ( !xResult.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return xResult; } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( packages::WrongPasswordException& ) + catch( packages::WrongPasswordException& aWrongPasswordException ) { + m_pImpl->AddLog( aWrongPasswordException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't clone stream!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't clone stream!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -2777,54 +2931,74 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneEncryptedStreamElement( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) - packages::NoEncryptionException(); // TODO: + packages::NoEncryptionException(); if ( !aPass.getLength() ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); try { uno::Reference< io::XStream > xResult; m_pImpl->CloneStreamElement( aStreamName, sal_True, aPass, xResult ); if ( !xResult.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return xResult; } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( packages::NoEncryptionException& ) + catch( packages::NoEncryptionException& aNoEncryptionException ) { + m_pImpl->AddLog( aNoEncryptionException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( packages::WrongPasswordException& ) + catch( packages::WrongPasswordException& aWrongPasswordException ) { + m_pImpl->AddLog( aWrongPasswordException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't clone encrypted stream!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't clone encrypted stream!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -2844,36 +3018,52 @@ void SAL_CALL OStorage::copyLastCommitTo( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } try { m_pImpl->CopyLastCommitTo( xTargetStorage ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy last commit version!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't copy last commit version!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -2895,14 +3085,17 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aStorName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aStorName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable storage name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name // it's allways possible to read written storage in this implementation sal_Int32 nStorageMode = embed::ElementModes::READ; @@ -2913,11 +3106,11 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo( if ( !pElement ) { // element does not exist, throw exception - throw io::IOException(); // TODO: access_denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access_denied } else if ( !pElement->m_bIsStorage ) { - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } if ( !pElement->m_pStorage ) @@ -2932,32 +3125,45 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo( pElement->m_pStorage->CopyLastCommitTo( xTargetStorage ); } else - throw io::IOException(); // TODO: general_error + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: general_error } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy last commit element version!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't copy last commit element version!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -2973,14 +3179,17 @@ sal_Bool SAL_CALL OStorage::isStreamElement( const ::rtl::OUString& aElementName ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable storage name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable name SotElement_Impl* pElement = NULL; @@ -2988,32 +3197,43 @@ sal_Bool SAL_CALL OStorage::isStreamElement( const ::rtl::OUString& aElementName { pElement = m_pImpl->FindElement( aElementName ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't detect whether it is a stream!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't detect whether it is a stream!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } if ( !pElement ) - throw container::NoSuchElementException(); //??? + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); //??? return !pElement->m_bIsStorage; } @@ -3028,14 +3248,17 @@ sal_Bool SAL_CALL OStorage::isStorageElement( const ::rtl::OUString& aElementNam ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); SotElement_Impl* pElement = NULL; @@ -3043,32 +3266,43 @@ sal_Bool SAL_CALL OStorage::isStorageElement( const ::rtl::OUString& aElementNam { pElement = m_pImpl->FindElement( aElementName ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't detect whether it is a storage" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't detect whether it is a storage" ) ), uno::Reference< io::XInputStream >(), aCaught ); } if ( !pElement ) - throw container::NoSuchElementException(); //??? + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); //??? return pElement->m_bIsStorage; } @@ -3087,58 +3321,76 @@ void SAL_CALL OStorage::removeElement( const ::rtl::OUString& aElementName ) ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable storage name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // TODO: unacceptable name if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); // TODO: access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied try { SotElement_Impl* pElement = m_pImpl->FindElement( aElementName ); if ( !pElement ) - throw container::NoSuchElementException(); //??? + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); //??? m_pImpl->RemoveElement( pElement ); m_pImpl->m_bIsModified = sal_True; m_pImpl->m_bBroadcastModified = sal_True; } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't remove element!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't remove element!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -3163,67 +3415,87 @@ void SAL_CALL OStorage::renameElement( const ::rtl::OUString& aElementName, cons ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) || !aNewName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && ( aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) || aNewName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable element name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); // TODO: unacceptable element name if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); // TODO: access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied try { SotElement_Impl* pRefElement = m_pImpl->FindElement( aNewName ); if ( pRefElement ) - throw container::ElementExistException(); //??? + throw container::ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); //??? SotElement_Impl* pElement = m_pImpl->FindElement( aElementName ); if ( !pElement ) - throw container::NoSuchElementException(); //??? + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); //??? pElement->m_aName = aNewName; m_pImpl->m_bIsModified = sal_True; m_pImpl->m_bBroadcastModified = sal_True; } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::ElementExistException& ) + catch( container::ElementExistException& aElementExistException ) { + m_pImpl->AddLog( aElementExistException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't rename element!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't rename element!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -3250,68 +3522,88 @@ void SAL_CALL OStorage::copyElementTo( const ::rtl::OUString& aElementName, ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) || !aNewName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !xDest.is() ) // || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && ( aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) || aNewName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable element name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); // unacceptable element name try { SotElement_Impl* pElement = m_pImpl->FindElement( aElementName ); if ( !pElement ) - throw container::NoSuchElementException(); //TODO + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< XNameAccess > xNameAccess( xDest, uno::UNO_QUERY ); if ( !xNameAccess.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( xNameAccess->hasByName( aNewName ) ) - throw container::ElementExistException(); + throw container::ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); m_pImpl->CopyStorageElement( pElement, xDest, aNewName, sal_False ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::ElementExistException& ) + catch( container::ElementExistException& aElementExistException ) { + m_pImpl->AddLog( aElementExistException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy element!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't copy element!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -3335,35 +3627,38 @@ void SAL_CALL OStorage::moveElementTo( const ::rtl::OUString& aElementName, ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) || !aNewName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && ( aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) || aNewName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable element name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); // unacceptable element name if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); // TODO: access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied try { SotElement_Impl* pElement = m_pImpl->FindElement( aElementName ); if ( !pElement ) - throw container::NoSuchElementException(); //??? + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); //??? uno::Reference< XNameAccess > xNameAccess( xDest, uno::UNO_QUERY ); if ( !xNameAccess.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( xNameAccess->hasByName( aNewName ) ) - throw container::ElementExistException(); + throw container::ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); m_pImpl->CopyStorageElement( pElement, xDest, aNewName, sal_False ); @@ -3372,38 +3667,55 @@ void SAL_CALL OStorage::moveElementTo( const ::rtl::OUString& aElementName, m_pImpl->m_bIsModified = sal_True; m_pImpl->m_bBroadcastModified = sal_True; } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::ElementExistException& ) + catch( container::ElementExistException& aElementExistException ) { + m_pImpl->AddLog( aElementExistException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't move element!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't move element!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -3432,75 +3744,93 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType == OFOPXML_STORAGE ) - throw uno::RuntimeException(); // the interface is not supported and must not be accessible + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface is not supported and must not be accessible if ( !sStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); uno::Reference < io::XInputStream > xTempIn; try { SotElement_Impl* pElement = m_pImpl->FindElement( sStreamName ); if ( !pElement ) - throw container::NoSuchElementException(); //TODO + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !pElement->m_pStream ) { m_pImpl->OpenSubStream( pElement ); if ( !pElement->m_pStream ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } uno::Reference< io::XInputStream > xRawInStream = pElement->m_pStream->GetPlainRawInStream(); if ( !xRawInStream.is() ) - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference < io::XOutputStream > xTempOut( m_pImpl->GetServiceFactory()->createInstance ( - ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ), uno::UNO_QUERY ); xTempIn = uno::Reference < io::XInputStream >( xTempOut, uno::UNO_QUERY ); uno::Reference < io::XSeekable > xSeek( xTempOut, uno::UNO_QUERY ); if ( !xTempOut.is() || !xTempIn.is() || !xSeek.is() ) - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // Copy temporary file to a new one ::comphelper::OStorageHelper::CopyInputToOutput( xRawInStream, xTempOut ); xTempOut->closeOutput(); xSeek->seek( 0 ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't get plain raw stream!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't get plain raw stream!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -3524,44 +3854,47 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) - throw packages::NoEncryptionException(); + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !sStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); uno::Reference < io::XInputStream > xTempIn; try { SotElement_Impl* pElement = m_pImpl->FindElement( sStreamName ); if ( !pElement ) - throw container::NoSuchElementException(); //TODO + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !pElement->m_pStream ) { m_pImpl->OpenSubStream( pElement ); if ( !pElement->m_pStream ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } if ( !pElement->m_pStream->IsEncrypted() ) - throw packages::NoEncryptionException(); // TODO + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< io::XInputStream > xRawInStream = pElement->m_pStream->GetRawInStream(); if ( !xRawInStream.is() ) - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference < io::XOutputStream > xTempOut( m_pImpl->GetServiceFactory()->createInstance ( - ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ), uno::UNO_QUERY ); xTempIn = uno::Reference < io::XInputStream >( xTempOut, uno::UNO_QUERY ); uno::Reference < io::XSeekable > xSeek( xTempOut, uno::UNO_QUERY ); if ( !xTempOut.is() || !xTempIn.is() || !xSeek.is() ) - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // Copy temporary file to a new one ::comphelper::OStorageHelper::CopyInputToOutput( xRawInStream, xTempOut ); @@ -3569,38 +3902,55 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement( xSeek->seek( 0 ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( packages::NoEncryptionException& ) + catch( packages::NoEncryptionException& aNoEncryptionException ) { + m_pImpl->AddLog( aNoEncryptionException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't get raw stream!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't get raw stream!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -3624,60 +3974,80 @@ void SAL_CALL OStorage::insertRawEncrStreamElement( const ::rtl::OUString& aStre ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) - throw packages::NoEncryptionException(); + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !xInStream.is() ) - throw lang::IllegalArgumentException(); // TODO + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); // TODO: access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied try { SotElement_Impl* pElement = m_pImpl->FindElement( aStreamName ); if ( pElement ) - throw container::ElementExistException(); //TODO + throw container::ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); m_pImpl->InsertRawStream( aStreamName, xInStream ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( packages::NoRawFormatException& ) + catch( packages::NoRawFormatException& aNoRawFormatException ) { + m_pImpl->AddLog( aNoRawFormatException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::ElementExistException& ) + catch( container::ElementExistException& aElementExistException ) { + m_pImpl->AddLog( aElementExistException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't insert raw stream!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't insert raw stream!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -3703,10 +4073,13 @@ void SAL_CALL OStorage::commit() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_bReadOnlyWrap ) - throw io::IOException(); // TODO: access_denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access_denied m_pImpl->Commit(); // the root storage initiates the storing to source @@ -3714,22 +4087,31 @@ void SAL_CALL OStorage::commit() if ( m_pImpl->m_pParent && m_pImpl->m_pParent->m_pAntiImpl ) xParentModif = (util::XModifiable*)m_pImpl->m_pParent->m_pAntiImpl; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Problems on commit!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Problems on commit!" ) ), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ), aCaught ); } @@ -3756,7 +4138,10 @@ void SAL_CALL OStorage::revert() ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } for ( SotElementList_Impl::iterator pElementIter = m_pImpl->m_aChildrenList.begin(); pElementIter != m_pImpl->m_aChildrenList.end(); pElementIter++ ) @@ -3765,7 +4150,7 @@ void SAL_CALL OStorage::revert() && ( (*pElementIter)->m_pStorage->m_pAntiImpl || !(*pElementIter)->m_pStorage->m_aReadOnlyWrapList.empty() )) || ((*pElementIter)->m_pStream && ( (*pElementIter)->m_pStream->m_pAntiImpl || !(*pElementIter)->m_pStream->m_aInputStreamsList.empty()) ) ) - throw io::IOException(); // TODO: access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied } if ( m_pData->m_bReadOnlyWrap || !m_pImpl->m_bListCreated ) @@ -3776,22 +4161,31 @@ void SAL_CALL OStorage::revert() m_pImpl->m_bIsModified = sal_False; m_pImpl->m_bBroadcastModified = sal_True; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Problems on revert!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Problems on revert!" ) ), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ), aCaught ); } @@ -3813,7 +4207,10 @@ void SAL_CALL OStorage::addTransactionListener( const uno::Reference< embed::XTr ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } m_pData->m_aListenersContainer.addInterface( ::getCppuType((const uno::Reference< embed::XTransactionListener >*)0), aListener ); @@ -3826,7 +4223,10 @@ void SAL_CALL OStorage::removeTransactionListener( const uno::Reference< embed:: ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } m_pData->m_aListenersContainer.removeInterface( ::getCppuType((const uno::Reference< embed::XTransactionListener >*)0), aListener ); @@ -3846,7 +4246,10 @@ sal_Bool SAL_CALL OStorage::isModified() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } return m_pImpl->m_bIsModified; } @@ -3860,10 +4263,13 @@ void SAL_CALL OStorage::setModified( sal_Bool bModified ) ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_bReadOnlyWrap ) - throw beans::PropertyVetoException(); // TODO: access denied + throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied if ( m_pImpl->m_bIsModified != bModified ) m_pImpl->m_bIsModified = bModified; @@ -3884,7 +4290,10 @@ void SAL_CALL OStorage::addModifyListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } m_pData->m_aListenersContainer.addInterface( ::getCppuType( ( const uno::Reference< util::XModifyListener >* )0 ), aListener ); @@ -3899,7 +4308,10 @@ void SAL_CALL OStorage::removeModifyListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } m_pData->m_aListenersContainer.removeInterface( ::getCppuType( ( const uno::Reference< util::XModifyListener >* )0 ), aListener ); @@ -3920,43 +4332,55 @@ uno::Any SAL_CALL OStorage::getByName( const ::rtl::OUString& aName ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable element name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable element name uno::Any aResult; try { SotElement_Impl* pElement = m_pImpl->FindElement( aName ); if ( !pElement ) - throw container::NoSuchElementException(); //TODO: + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( pElement->m_bIsStorage ) aResult <<= openStorageElement( aName, embed::ElementModes::READ ); else aResult <<= openStreamElement( aName, embed::ElementModes::READ ); } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::WrappedTargetException& ) + catch( lang::WrappedTargetException& aWrappedTargetException ) { + m_pImpl->AddLog( aWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), + throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open storage!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); @@ -3975,20 +4399,28 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OStorage::getElementNames() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } try { return m_pImpl->GetElementNames(); } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), + throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open storage!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); @@ -4005,7 +4437,10 @@ sal_Bool SAL_CALL OStorage::hasByName( const ::rtl::OUString& aName ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aName.getLength() ) return sal_False; @@ -4019,14 +4454,19 @@ sal_Bool SAL_CALL OStorage::hasByName( const ::rtl::OUString& aName ) { pElement = m_pImpl->FindElement( aName ); } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), + throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open storage!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); @@ -4043,7 +4483,10 @@ uno::Type SAL_CALL OStorage::getElementType() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } // it is a multitype container return uno::Type(); @@ -4059,20 +4502,28 @@ sal_Bool SAL_CALL OStorage::hasElements() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } try { return ( m_pImpl->GetChildrenList().size() != 0 ); } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), + throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open storage!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); @@ -4091,20 +4542,28 @@ void SAL_CALL OStorage::dispose() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } try { InternalDispose( sal_True ); } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), + throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open storage!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); @@ -4119,7 +4578,10 @@ void SAL_CALL OStorage::addEventListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } m_pData->m_aListenersContainer.addInterface( ::getCppuType( ( const uno::Reference< lang::XEventListener >* )0 ), xListener ); @@ -4133,7 +4595,10 @@ void SAL_CALL OStorage::removeEventListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } m_pData->m_aListenersContainer.removeInterface( ::getCppuType( ( const uno::Reference< lang::XEventListener >* )0 ), xListener ); @@ -4152,10 +4617,13 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) - throw uno::RuntimeException(); // the interface must be visible only for package storage + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage OSL_ENSURE( m_pData->m_bIsRoot, "setEncryptionPassword() method is not available for nonroot storages!\n" ); @@ -4164,14 +4632,19 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) try { m_pImpl->ReadContents(); } - catch ( uno::RuntimeException& ) + catch ( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetException( ::rtl::OUString::createFromAscii( "Can not open package!\n" ), + throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); @@ -4179,20 +4652,23 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY ); if ( !xPackPropSet.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); try { - xPackPropSet->setPropertyValue( ::rtl::OUString::createFromAscii("EncryptionKey"), + xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ), uno::makeAny( MakeKeyFromPass( aPass, sal_True ) ) ); m_pImpl->m_bHasCommonPassword = sal_True; m_pImpl->m_aCommonPassword = aPass; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + OSL_ENSURE( sal_False, "The call must not fail, it is pretty simple!" ); - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } } } @@ -4207,10 +4683,13 @@ void SAL_CALL OStorage::removeEncryption() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) - throw uno::RuntimeException(); // the interface must be visible only for package storage + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage OSL_ENSURE( m_pData->m_bIsRoot, "removeEncryption() method is not available for nonroot storages!\n" ); @@ -4219,14 +4698,19 @@ void SAL_CALL OStorage::removeEncryption() try { m_pImpl->ReadContents(); } - catch ( uno::RuntimeException& ) + catch ( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open package!\n" ), + throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); @@ -4237,20 +4721,23 @@ void SAL_CALL OStorage::removeEncryption() uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY ); if ( !xPackPropSet.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); try { - xPackPropSet->setPropertyValue( ::rtl::OUString::createFromAscii("EncryptionKey"), + xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ), uno::makeAny( uno::Sequence< sal_Int8 >() ) ); m_pImpl->m_bHasCommonPassword = sal_False; m_pImpl->m_aCommonPassword = ::rtl::OUString(); } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + OSL_ENSURE( sal_False, "The call must not fail, it is pretty simple!" ); - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } } } @@ -4266,7 +4753,10 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL OStorage::getPropertySetInfo( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } //TODO: return uno::Reference< beans::XPropertySetInfo >(); @@ -4286,15 +4776,18 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } //TODO: think about interaction handler if ( m_pData->m_bReadOnlyWrap ) - throw io::IOException(); // TODO: Access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: Access denied if ( m_pData->m_nStorageType == ZIP_STORAGE ) - throw beans::UnknownPropertyException(); // TODO + throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); else if ( m_pData->m_nStorageType == PACKAGE_STORAGE ) { if ( aPropertyName.equalsAscii( "MediaType" ) ) @@ -4318,9 +4811,9 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, || aPropertyName.equalsAscii( "RepairPackage" ) ) || aPropertyName.equalsAscii( "IsRoot" ) || aPropertyName.equalsAscii( "MediaTypeFallbackUsed" ) ) - throw beans::PropertyVetoException(); // TODO + throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); else - throw beans::UnknownPropertyException(); // TODO + throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } else if ( m_pData->m_nStorageType == OFOPXML_STORAGE ) { @@ -4335,7 +4828,7 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, // currently this is an internal property that is used for optimization // and the stream must support XSeekable interface // TODO/LATER: in future it can be changed if property is used from outside - throw lang::IllegalArgumentException(); // TODO + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); } m_pImpl->m_xNewRelInfoStream = xInRelStream; @@ -4345,7 +4838,7 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, m_pImpl->m_bIsModified = sal_True; } else - throw lang::IllegalArgumentException(); // TODO + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); } else if ( aPropertyName.equalsAscii( "RelationsInfo" ) ) { @@ -4357,17 +4850,17 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, m_pImpl->m_bIsModified = sal_True; } else - throw lang::IllegalArgumentException(); // TODO + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); } else if ( m_pData->m_bIsRoot && ( aPropertyName.equalsAscii( "URL" ) || aPropertyName.equalsAscii( "RepairPackage" ) ) || aPropertyName.equalsAscii( "IsRoot" ) ) - throw beans::PropertyVetoException(); // TODO + throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); else - throw beans::UnknownPropertyException(); // TODO + throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } else - throw beans::UnknownPropertyException(); // TODO + throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); BroadcastModifiedIfNecessary(); } @@ -4384,7 +4877,10 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType == PACKAGE_STORAGE && ( aPropertyName.equalsAscii( "MediaType" ) @@ -4395,15 +4891,20 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa { m_pImpl->ReadContents(); } - catch ( uno::RuntimeException& ) + catch ( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); throw lang::WrappedTargetException( - ::rtl::OUString::createFromAscii( "Can't read contents!" ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't read contents!" ) ), uno::Reference< XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); } @@ -4445,18 +4946,23 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa m_pImpl->ReadContents(); uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY ); if ( !xPackPropSet.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return xPackPropSet->getPropertyValue( aPropertyName ); } - catch ( uno::RuntimeException& ) + catch ( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch ( uno::Exception& ) + catch ( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetException( ::rtl::OUString::createFromAscii( "Can not open package!\n" ), + throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); @@ -4464,7 +4970,7 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa } } - throw beans::UnknownPropertyException(); // TODO + throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } @@ -4479,7 +4985,10 @@ void SAL_CALL OStorage::addPropertyChangeListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } //TODO: } @@ -4496,7 +5005,10 @@ void SAL_CALL OStorage::removePropertyChangeListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } //TODO: } @@ -4513,7 +5025,10 @@ void SAL_CALL OStorage::addVetoableChangeListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } //TODO: } @@ -4530,7 +5045,10 @@ void SAL_CALL OStorage::removeVetoableChangeListener( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } //TODO: } @@ -4549,18 +5067,24 @@ sal_Bool SAL_CALL OStorage::hasByID( const ::rtl::OUString& sID ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); try { getRelationshipByID( sID ); return sal_True; } - catch( container::NoSuchElementException& ) - {} + catch( container::NoSuchElementException& aNoSuchElementException ) + { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) ); + } return sal_False; } @@ -4574,10 +5098,13 @@ sal_Bool SAL_CALL OStorage::hasByID( const ::rtl::OUString& sID ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ ) @@ -4596,10 +5123,13 @@ sal_Bool SAL_CALL OStorage::hasByID( const ::rtl::OUString& sID ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ ) @@ -4618,10 +5148,13 @@ uno::Sequence< beans::StringPair > SAL_CALL OStorage::getRelationshipByID( cons ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO/LATER: in future the unification of the ID could be checked uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); @@ -4634,7 +5167,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OStorage::getRelationshipByID( cons break; } - throw container::NoSuchElementException(); + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } //----------------------------------------------- @@ -4645,10 +5178,13 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getRelati ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< uno::Sequence< beans::StringPair > > aResult; sal_Int32 nEntriesNum = 0; @@ -4678,10 +5214,13 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getAllRel ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return m_pImpl->GetAllRelationshipsIfAny(); } @@ -4695,10 +5234,13 @@ void SAL_CALL OStorage::insertRelationshipByID( const ::rtl::OUString& sID, con ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); ::rtl::OUString aIDTag( RTL_CONSTASCII_USTRINGPARAM( "Id" ) ); @@ -4740,7 +5282,7 @@ void SAL_CALL OStorage::insertRelationshipByID( const ::rtl::OUString& sID, con aSeq[nIDInd].realloc( nIndTarget ); } else - throw container::ElementExistException(); // TODO + throw container::ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); m_pImpl->m_aRelInfo = aSeq; @@ -4757,10 +5299,13 @@ void SAL_CALL OStorage::removeRelationshipByID( const ::rtl::OUString& sID ) ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); for ( sal_Int32 nInd1 = 0; nInd1 < aSeq.getLength(); nInd1++ ) @@ -4784,7 +5329,7 @@ void SAL_CALL OStorage::removeRelationshipByID( const ::rtl::OUString& sID ) break; } - throw container::NoSuchElementException(); + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } //----------------------------------------------- @@ -4796,10 +5341,13 @@ void SAL_CALL OStorage::insertRelationships( const uno::Sequence< uno::Sequence ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); ::rtl::OUString aIDTag( RTL_CONSTASCII_USTRINGPARAM( "Id" ) ); uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); @@ -4820,7 +5368,7 @@ void SAL_CALL OStorage::insertRelationships( const uno::Sequence< uno::Sequence if ( aEntries[nIndSource1][nIndSource2].Second.equals( aSeq[nIndTarget1][nIndTarget2].Second ) ) { if ( !bReplace ) - throw container::ElementExistException(); + throw container::ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); nIndSourceSame = nIndSource1; } @@ -4853,10 +5401,10 @@ void SAL_CALL OStorage::insertRelationships( const uno::Sequence< uno::Sequence else if ( nResInd2 < aResultSeq[nResultInd].getLength() ) aResultSeq[nResultInd][nResInd2++] = aEntries[nIndSource1][nIndSource2]; else - throw io::IOException(); // TODO: illegal relation ( no ID ) + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: illegal relation ( no ID ) if ( !bHasID ) - throw io::IOException(); // TODO: illegal relations + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: illegal relations nResultInd++; } @@ -4875,10 +5423,13 @@ void SAL_CALL OStorage::clearRelationships() ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != OFOPXML_STORAGE ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); m_pImpl->m_aRelInfo.realloc( 0 ); m_pImpl->m_xNewRelInfoStream = uno::Reference< io::XInputStream >(); @@ -4902,7 +5453,7 @@ void SAL_CALL OStorage::insertRawNonEncrStreamElementDirect( { // not implemented currently because there is still no demand // might need to be implemented if direct copying of compressed streams is used - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } //----------------------------------------------- @@ -4922,58 +5473,76 @@ void SAL_CALL OStorage::insertStreamElementDirect( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aStreamName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable storage name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name if ( m_pData->m_bReadOnlyWrap ) - throw io::IOException(); // TODO: access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied try { SotElement_Impl* pElement = m_pImpl->FindElement( aStreamName ); if ( pElement ) - throw container::ElementExistException(); + throw container::ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); pElement = OpenStreamElement_Impl( aStreamName, embed::ElementModes::READWRITE, sal_False ); OSL_ENSURE( pElement && pElement->m_pStream, "In case element can not be created an exception must be thrown!" ); pElement->m_pStream->InsertStreamDirectly( xInStream, aProps ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::ElementExistException ) + catch( container::ElementExistException& aElementExistException ) { + m_pImpl->AddLog( aElementExistException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't insert stream directly!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't insert stream directly!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -4997,68 +5566,89 @@ void SAL_CALL OStorage::copyElementDirectlyTo( ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) || !aNewName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE - && aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable storage name + && ( aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) + || aNewName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) ) + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); // unacceptable name try { SotElement_Impl* pElement = m_pImpl->FindElement( aElementName ); if ( !pElement ) - throw container::NoSuchElementException(); //TODO + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< XNameAccess > xNameAccess( xDest, uno::UNO_QUERY ); if ( !xNameAccess.is() ) - throw uno::RuntimeException(); // TODO + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( xNameAccess->hasByName( aNewName ) ) - throw container::ElementExistException(); + throw container::ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // let the element be copied directly uno::Reference< embed::XStorage > xStorDest( xDest, uno::UNO_QUERY_THROW ); m_pImpl->CopyStorageElement( pElement, xStorDest, aNewName, sal_True ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::ElementExistException& ) + catch( container::ElementExistException& aElementExistException ) { + m_pImpl->AddLog( aElementExistException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy element direcly!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't copy element direcly!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -5077,42 +5667,58 @@ void SAL_CALL OStorage::writeAndAttachToStream( const uno::Reference< io::XStrea ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !m_pData->m_bIsRoot ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); if ( !m_pImpl->m_pSwitchStream ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); try { m_pImpl->m_pSwitchStream->CopyAndSwitchPersistenceTo( xStream ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't write and attach to stream!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't write and attach to stream!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -5133,17 +5739,20 @@ void SAL_CALL OStorage::attachToURL( const ::rtl::OUString& sURL, ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !m_pData->m_bIsRoot ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); if ( !m_pImpl->m_pSwitchStream ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference < ucb::XSimpleFileAccess > xAccess( m_pImpl->m_xFactory->createInstance ( - ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), uno::UNO_QUERY_THROW ); try @@ -5159,30 +5768,43 @@ void SAL_CALL OStorage::attachToURL( const ::rtl::OUString& sURL, m_pImpl->m_pSwitchStream->SwitchPersistenceTo( xStream ); } } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't attach to URL!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't attach to URL!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -5204,70 +5826,92 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const ::rtl::OUString& aEle ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aElementName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable storage name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // TODO: unacceptable name try { SotElement_Impl *pElement = m_pImpl->FindElement( aElementName ); if ( !pElement ) - throw container::NoSuchElementException(); + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO/LATER: Currently it is only implemented for MediaType property of substorages, might be changed in future if ( !pElement->m_bIsStorage || m_pData->m_nStorageType != PACKAGE_STORAGE || !aPropertyName.equalsAscii( "MediaType" ) ) - throw beans::PropertyVetoException(); + throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !pElement->m_pStorage ) m_pImpl->OpenSubStorage( pElement, embed::ElementModes::READ ); if ( !pElement->m_pStorage ) - throw io::IOException(); // TODO: general_error + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: general_error pElement->m_pStorage->ReadContents(); return uno::makeAny( pElement->m_pStorage->m_aMediaType ); } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( container::NoSuchElementException& ) + catch( container::NoSuchElementException& aNoSuchElementException ) { + m_pImpl->AddLog( aNoSuchElementException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( beans::UnknownPropertyException& ) + catch( beans::UnknownPropertyException& aUnknownPropertyException ) { + m_pImpl->AddLog( aUnknownPropertyException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( beans::PropertyVetoException& ) + catch( beans::PropertyVetoException& aPropertyVetoException ) { + m_pImpl->AddLog( aPropertyVetoException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't get element property!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't get element property!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -5285,17 +5929,20 @@ void SAL_CALL OStorage::copyStreamElementData( const ::rtl::OUString& aStreamNam ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aStreamName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels" ) ) ) ) - throw lang::IllegalArgumentException(); // TODO: unacceptable storage name + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); // unacceptable name if ( !xTargetStream.is() ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); try { @@ -5304,36 +5951,51 @@ void SAL_CALL OStorage::copyStreamElementData( const ::rtl::OUString& aStreamNam OSL_ENSURE( xNonconstRef == xTargetStream, "The provided stream reference seems not be filled in correctly!\n" ); if ( xNonconstRef != xTargetStream ) - throw uno::RuntimeException(); // if the stream reference is set it must not be changed! + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // if the stream reference is set it must not be changed! } - catch( embed::InvalidStorageException& ) + catch( embed::InvalidStorageException& aInvalidStorageException ) { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( lang::IllegalArgumentException& ) + catch( lang::IllegalArgumentException& aIllegalArgumentException ) { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( packages::WrongPasswordException& ) + catch( packages::WrongPasswordException& aWrongPasswordException ) { + m_pImpl->AddLog( aWrongPasswordException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( io::IOException& ) + catch( io::IOException& aIOException ) { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( embed::StorageWrappedTargetException& ) + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::RuntimeException& ) + catch( uno::RuntimeException& aRuntimeException ) { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); throw; } - catch( uno::Exception& ) + catch( uno::Exception& aException ) { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy stream data!" ), + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't copy stream data!" ) ), uno::Reference< io::XInputStream >(), aCaught ); } @@ -5357,14 +6019,17 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openStreamEle ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) && ( nOpenMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); // Access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // Access denied OStringList_Impl aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); @@ -5396,7 +6061,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openStreamEle } if ( !xResult.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return xResult; } @@ -5414,20 +6079,23 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( m_pData->m_nStorageType != PACKAGE_STORAGE ) - packages::NoEncryptionException(); // TODO: + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !sPassword.getLength() ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 3 ); if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) && ( nOpenMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); // Access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // Access denied OStringList_Impl aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); @@ -5460,7 +6128,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted } if ( !xResult.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return xResult; } @@ -5477,13 +6145,16 @@ void SAL_CALL OStorage::removeStreamElementByHierarchicalName( const ::rtl::OUSt ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); if ( !m_pImpl ) - throw lang::DisposedException(); + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); // Access denied + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // Access denied OStringList_Impl aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index d9e9c6e39491..91be457b02cb 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -54,6 +54,7 @@ #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/packages/NoEncryptionException.hpp> +#include <com/sun/star/logging/XSimpleLogRing.hpp> #include <cppuhelper/weak.hxx> #include <cppuhelper/interfacecontainer.h> @@ -155,6 +156,7 @@ struct OStorage_Impl SotElementList_Impl m_aDeletedList; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xPackageFolder; + ::com::sun::star::uno::Reference< ::com::sun::star::logging::XSimpleLogRing > m_xLogRing; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > m_xPackage; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; @@ -212,6 +214,8 @@ struct OStorage_Impl ~OStorage_Impl(); + void AddLog( const ::rtl::OUString& aMessage ); + void SetReadOnlyWrap( OStorage& aStorage ); void RemoveReadOnlyWrap( OStorage& aStorage ); diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx index fb88774ea27f..7e8433d77837 100644 --- a/package/source/zipapi/ByteGrabber.cxx +++ b/package/source/zipapi/ByteGrabber.cxx @@ -73,14 +73,14 @@ sal_Int64 SAL_CALL ByteGrabber::seek( sal_Int64 location ) { sal_Int64 nLen = xSeek->getLength(); if ( location < 0 || location > nLen ) - throw lang::IllegalArgumentException(); + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); if (location > nLen ) location = nLen; xSeek->seek( location ); return location; } else - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } sal_Int64 SAL_CALL ByteGrabber::getPosition( ) throw(io::IOException, uno::RuntimeException) @@ -88,7 +88,7 @@ sal_Int64 SAL_CALL ByteGrabber::getPosition( ) if (xSeek.is() ) return xSeek->getPosition(); else - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } sal_Int64 SAL_CALL ByteGrabber::getLength( ) throw(io::IOException, uno::RuntimeException) @@ -96,7 +96,7 @@ sal_Int64 SAL_CALL ByteGrabber::getLength( ) if (xSeek.is() ) return xSeek->getLength(); else - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } ByteGrabber& ByteGrabber::operator >> (sal_Int8& rInt8) { diff --git a/package/source/zipapi/XFileStream.cxx b/package/source/zipapi/XFileStream.cxx index 09df729809d4..7549c3873169 100644 --- a/package/source/zipapi/XFileStream.cxx +++ b/package/source/zipapi/XFileStream.cxx @@ -210,7 +210,7 @@ void SAL_CALL XFileStream::seek( sal_Int64 location ) throw( IllegalArgumentException, IOException, RuntimeException) { if ( location > mnZipSize || location < 0 ) - throw IllegalArgumentException(); + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); if ( location > mxTempSeek->getLength() ) { sal_Int64 nUntil = location + n_ConstBufferSize > mnZipSize ? mnZipSize : location + n_ConstBufferSize; diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 0be136e75d6f..1ddf31a66c5f 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -298,7 +298,7 @@ Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const Reference< Reference< XInterface >() ); if ( !rData->aKey.getLength() ) - throw packages::WrongPasswordException(); + throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); Reference< XSeekable > xSeek( xStream, UNO_QUERY ); if ( !xSeek.is() ) @@ -324,7 +324,7 @@ Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const Reference< xStream->readBytes( aReadBuffer, nSize ); if ( !StaticHasValidPassword( aReadBuffer, rData ) ) - throw packages::WrongPasswordException(); + throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } return new XUnbufferedStream ( xStream, rData ); @@ -557,7 +557,7 @@ Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry, // check if we can decrypt it or not OSL_ENSURE( rData->aDigest.getLength(), "Can't detect password correctness without digest!\n" ); if ( rData->aDigest.getLength() && !hasValidPassword ( rEntry, rData ) ) - throw packages::WrongPasswordException(); + throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } else bNeedRawStream = ( rEntry.nMethod == STORED ); @@ -589,7 +589,7 @@ Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream( RuntimeException ) { if ( rData.isEmpty() ) - throw packages::NoEncryptionException(); + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( rEntry.nOffset <= 0 ) readLOC( rEntry ); diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 2dd5e0a563d0..caf64748afaa 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -390,7 +390,7 @@ void ZipPackage::parseContentType() try { // the content type must exist in OFOPXML format! if ( !xRootFolder->hasByName( aContentTypes ) ) - throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Wrong format!" ) ), + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong format!" ) ), uno::Reference< uno::XInterface >() ); uno::Reference< lang::XUnoTunnel > xTunnel; @@ -408,7 +408,7 @@ void ZipPackage::parseContentType() ::comphelper::OFOPXMLHelper::ReadContentTypeSequence( xInStream, xFactory ); if ( aContentTypeInfo.getLength() != 2 ) - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // set the implicit types fist for ( nInd = 0; nInd < aContentTypeInfo[0].getLength(); nInd++ ) @@ -626,7 +626,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments ) else if ( aFormatName.equalsAscii( "OFOPXMLFormat" ) ) m_nFormat = OFOPXML_FORMAT; else - throw lang::IllegalArgumentException(); // TODO: + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); pRootFolder->setPackageFormat_Impl( m_nFormat ); } @@ -642,7 +642,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments ) else { // The URL is not acceptable - throw com::sun::star::uno::Exception ( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Bad arguments." ) ), + throw com::sun::star::uno::Exception ( OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Bad arguments." ) ), static_cast < ::cppu::OWeakObject * > ( this ) ); } } @@ -655,7 +655,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments ) xContentStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( xContentStream, xFactory ); xContentSeek = uno::Reference < XSeekable > ( xContentStream, UNO_QUERY ); if ( ! xContentSeek.is() ) - throw com::sun::star::uno::Exception ( OUString( RTL_CONSTASCII_USTRINGPARAM ( "The package component _requires_ an XSeekable interface!" ) ), + throw com::sun::star::uno::Exception ( OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "The package component _requires_ an XSeekable interface!" ) ), static_cast < ::cppu::OWeakObject * > ( this ) ); if ( !xContentSeek->getLength() ) @@ -698,7 +698,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments ) if( pZipFile ) { delete pZipFile; pZipFile = NULL; } throw com::sun::star::packages::zip::ZipIOException ( - OUString( RTL_CONSTASCII_USTRINGPARAM ( "Bad Zip File." ) ), + OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Bad Zip File." ) ), static_cast < ::cppu::OWeakObject * > ( this ) ); } } @@ -764,7 +764,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) pCurrent = pCurrent->doGetByName(sTemp).pFolder; } else - throw NoSuchElementException(); + throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); nOldIndex = nIndex+1; } if ( bFolder ) @@ -783,7 +783,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) return pCurrent->getByName( sTemp ); } else - throw NoSuchElementException(); + throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } } } @@ -922,7 +922,7 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut ) { VOS_ENSURE( 0, "Error adding mimetype to the ZipOutputStream" ); throw WrappedTargetException( - OUString( RTL_CONSTASCII_USTRINGPARAM ( "Error adding mimetype to the ZipOutputStream!" ) ), + OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Error adding mimetype to the ZipOutputStream!" ) ), static_cast < OWeakObject * > ( this ), makeAny( r ) ); } @@ -1084,7 +1084,7 @@ sal_Bool ZipPackage::writeFileIsTemp() VOS_ENSURE ( 0, "Couldn't get a ManifestWriter!" ); IOException aException; throw WrappedTargetException( - OUString( RTL_CONSTASCII_USTRINGPARAM ( "Couldn't get a ManifestWriter!" ) ), + OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Couldn't get a ManifestWriter!" ) ), static_cast < OWeakObject * > ( this ), makeAny( aException ) ); } @@ -1181,7 +1181,7 @@ sal_Bool ZipPackage::writeFileIsTemp() throw aException; throw WrappedTargetException( - OUString( RTL_CONSTASCII_USTRINGPARAM ( "Problem writing the original content!" ) ), + OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Problem writing the original content!" ) ), static_cast < OWeakObject * > ( this ), aCaught ); } @@ -1189,7 +1189,7 @@ sal_Bool ZipPackage::writeFileIsTemp() { // the document is written directly, although it was empty it is important to notify that the writing has failed // TODO/LATER: let the package be able to recover in this situation - ::rtl::OUString aErrTxt( RTL_CONSTASCII_USTRINGPARAM ( "This package is unusable!" ) ); + ::rtl::OUString aErrTxt( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "This package is unusable!" ) ); embed::UseBackupException aException( aErrTxt, uno::Reference< uno::XInterface >(), ::rtl::OUString() ); throw WrappedTargetException( aErrTxt, static_cast < OWeakObject * > ( this ), @@ -1265,7 +1265,7 @@ void SAL_CALL ZipPackage::commitChanges( ) if ( eMode == e_IMode_XInputStream ) { IOException aException; - throw WrappedTargetException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "This package is read only!" ) ), + throw WrappedTargetException( OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "This package is read only!" ) ), static_cast < OWeakObject * > ( this ), makeAny ( aException ) ); } @@ -1289,14 +1289,14 @@ void SAL_CALL ZipPackage::commitChanges( ) xOutputStream = xStream->getOutputStream(); uno::Reference < XTruncate > xTruncate ( xOutputStream, UNO_QUERY ); if ( !xTruncate.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // after successful truncation the original file contents are already lost xTruncate->truncate(); } catch( uno::Exception& r ) { - throw WrappedTargetException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "This package is read only!" ) ), + throw WrappedTargetException( OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "This package is read only!" ) ), static_cast < OWeakObject * > ( this ), makeAny ( r ) ); } @@ -1372,7 +1372,7 @@ void SAL_CALL ZipPackage::commitChanges( ) uno::Reference < XPropertySet > xPropSet ( xContentStream, UNO_QUERY ); OSL_ENSURE( xPropSet.is(), "This is a temporary file that must implement XPropertySet!\n" ); if ( !xPropSet.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); OUString sTargetFolder = sURL.copy ( 0, sURL.lastIndexOf ( static_cast < sal_Unicode > ( '/' ) ) ); Content aContent ( sTargetFolder, uno::Reference < XCommandEnvironment > () ); @@ -1399,7 +1399,7 @@ void SAL_CALL ZipPackage::commitChanges( ) DisconnectFromTargetAndThrowException_Impl( xContentStream ); throw WrappedTargetException( - OUString( RTL_CONSTASCII_USTRINGPARAM ( "This package may be read only!" ) ), + OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "This package may be read only!" ) ), static_cast < OWeakObject * > ( this ), makeAny ( r ) ); } @@ -1434,7 +1434,7 @@ void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Referenc OSL_ENSURE( sal_False, "These calls are pretty simple, they should not fail!\n" ); } - ::rtl::OUString aErrTxt( RTL_CONSTASCII_USTRINGPARAM ( "This package is read only!" ) ); + ::rtl::OUString aErrTxt( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "This package is read only!" ) ); embed::UseBackupException aException( aErrTxt, uno::Reference< uno::XInterface >(), aTempURL ); throw WrappedTargetException( aErrTxt, static_cast < OWeakObject * > ( this ), @@ -1536,30 +1536,30 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { if ( m_nFormat != PACKAGE_FORMAT ) - throw UnknownPropertyException(); + throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HasEncryptedEntries") ) ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaTypeFallbackUsed") ) ) - throw PropertyVetoException(); + throw PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) ) { if (!( aValue >>= aEncryptionKey ) ) - throw IllegalArgumentException(); + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); } else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UseManifest") ) ) { if (!( aValue >>= bUseManifest ) ) - throw IllegalArgumentException(); + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); } else - throw UnknownPropertyException(); + throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } Any SAL_CALL ZipPackage::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { // TODO/LATER: Activate the check when zip-ucp is ready // if ( m_nFormat != PACKAGE_FORMAT ) - // throw UnknownPropertyException(); + // throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); Any aAny; if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "EncryptionKey" ) ) ) @@ -1582,7 +1582,7 @@ Any SAL_CALL ZipPackage::getPropertyValue( const OUString& PropertyName ) aAny <<= m_bMediaTypeFallbackUsed; return aAny; } - throw UnknownPropertyException(); + throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } void SAL_CALL ZipPackage::addPropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) diff --git a/package/source/zippackage/ZipPackageBuffer.cxx b/package/source/zippackage/ZipPackageBuffer.cxx index e2ec750b47d5..114c04adbcbe 100644 --- a/package/source/zippackage/ZipPackageBuffer.cxx +++ b/package/source/zippackage/ZipPackageBuffer.cxx @@ -33,7 +33,7 @@ #include <ZipPackageBuffer.hxx> #include <string.h> // for memcpy - +using namespace ::com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::io; using com::sun::star::lang::IllegalArgumentException; @@ -53,7 +53,7 @@ sal_Int32 SAL_CALL ZipPackageBuffer::readBytes( Sequence< sal_Int8 >& aData, sal throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) { if (nBytesToRead < 0) - throw BufferSizeExceededException(::rtl::OUString(),*this); + throw BufferSizeExceededException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), *this ); if (nBytesToRead + m_nCurrent > m_nEnd) nBytesToRead = static_cast < sal_Int32 > (m_nEnd - m_nCurrent); @@ -73,7 +73,7 @@ void SAL_CALL ZipPackageBuffer::skipBytes( sal_Int32 nBytesToSkip ) throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) { if (nBytesToSkip < 0) - throw BufferSizeExceededException(::rtl::OUString(),*this); + throw BufferSizeExceededException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), *this ); if (nBytesToSkip + m_nCurrent > m_nEnd) nBytesToSkip = static_cast < sal_Int32 > (m_nEnd - m_nCurrent); @@ -124,7 +124,7 @@ void SAL_CALL ZipPackageBuffer::seek( sal_Int64 location ) throw( IllegalArgumentException, IOException, RuntimeException) { if ( location > m_nEnd || location < 0 ) - throw IllegalArgumentException(); + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); m_nCurrent = location; } sal_Int64 SAL_CALL ZipPackageBuffer::getPosition( ) diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx index 621272761b8b..51bcfa697213 100644 --- a/package/source/zippackage/ZipPackageEntry.cxx +++ b/package/source/zippackage/ZipPackageEntry.cxx @@ -78,7 +78,7 @@ void SAL_CALL ZipPackageEntry::setName( const OUString& aName ) // unfortunately no other exception than RuntimeException can be thrown here // usually the package is used through storage implementation, the problem should be detected there if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aName, sal_True ) ) - throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), Reference< XInterface >() ); + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected character is used in file name." ) ), Reference< XInterface >() ); aEntry.sName = aName; @@ -106,7 +106,7 @@ void SAL_CALL ZipPackageEntry::setParent( const Reference< XInterface >& xNewPar sal_Int64 nTest(0); Reference < XUnoTunnel > xTunnel ( xNewParent, UNO_QUERY ); if ( !xNewParent.is() || ( nTest = xTunnel->getSomething ( ZipPackageFolder::static_getImplementationId () ) ) == 0 ) - throw NoSupportException(); + throw NoSupportException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); ZipPackageFolder *pNewParent = reinterpret_cast < ZipPackageFolder * > ( nTest ); diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 8e0c8718dbfb..2787ad938df9 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -140,7 +140,7 @@ void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any& throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException) { if (hasByName(aName)) - throw ElementExistException(); + throw ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); else { Reference < XUnoTunnel > xRef; @@ -160,14 +160,14 @@ void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any& pEntry = static_cast < ZipPackageEntry * > ( pStream ); } else - throw IllegalArgumentException(); + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); if (pEntry->getName() != aName ) pEntry->setName (aName); doInsertByName ( pEntry, sal_True ); } else - throw IllegalArgumentException(); + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 ); } } void SAL_CALL ZipPackageFolder::removeByName( const OUString& Name ) @@ -175,7 +175,7 @@ void SAL_CALL ZipPackageFolder::removeByName( const OUString& Name ) { ContentHash::iterator aIter = maContents.find ( Name ); if ( aIter == maContents.end() ) - throw NoSuchElementException(); + throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); maContents.erase( aIter ); } // XEnumerationAccess @@ -201,7 +201,7 @@ ContentInfo& ZipPackageFolder::doGetByName( const OUString& aName ) { ContentHash::iterator aIter = maContents.find ( aName ); if ( aIter == maContents.end()) - throw NoSuchElementException(); + throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return *(*aIter).second; } Any SAL_CALL ZipPackageFolder::getByName( const OUString& aName ) @@ -233,7 +233,7 @@ void SAL_CALL ZipPackageFolder::replaceByName( const OUString& aName, const Any& if ( hasByName( aName ) ) removeByName( aName ); else - throw NoSuchElementException(); + throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); insertByName(aName, aElement); } @@ -644,7 +644,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr } if( bWritingFailed ) - throw RuntimeException(); + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } void ZipPackageFolder::releaseUpwardRef( void ) @@ -692,7 +692,7 @@ void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName, { // TODO/LATER: activate when zip ucp is ready // if ( m_nFormat != PACKAGE_FORMAT ) - // throw UnknownPropertyException(); + // throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); aValue >>= sMediaType; } @@ -701,7 +701,7 @@ void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName, else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Size") ) ) aValue >>= aEntry.nSize; else - throw UnknownPropertyException(); + throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) @@ -710,7 +710,7 @@ Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName ) { // TODO/LATER: activate when zip ucp is ready // if ( m_nFormat != PACKAGE_FORMAT ) - // throw UnknownPropertyException(); + // throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return makeAny ( sMediaType ); } @@ -719,7 +719,7 @@ Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName ) else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Size" ) ) ) return makeAny ( aEntry.nSize ); else - throw UnknownPropertyException(); + throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetParent ) diff --git a/package/source/zippackage/ZipPackageFolderEnumeration.cxx b/package/source/zippackage/ZipPackageFolderEnumeration.cxx index cb67cc333348..8f4a2204fbdc 100644 --- a/package/source/zippackage/ZipPackageFolderEnumeration.cxx +++ b/package/source/zippackage/ZipPackageFolderEnumeration.cxx @@ -56,7 +56,7 @@ uno::Any SAL_CALL ZipPackageFolderEnumeration::nextElement( ) { uno::Any aAny; if (aIterator == rContents.end() ) - throw container::NoSuchElementException(); + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); aAny <<= (*aIterator).second->xTunnel; aIterator++; return aAny; diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index ef1fae055b06..ad68f34fd71c 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -144,7 +144,7 @@ uno::Reference< io::XInputStream >& ZipPackageStream::GetOwnSeekStream() xStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( xStream, m_xFactory ); Reference< io::XSeekable > xSeek( xStream, UNO_QUERY ); if ( !xSeek.is() ) - throw RuntimeException( OUString::createFromAscii( "The stream must support XSeekable!" ), + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "The stream must support XSeekable!" ) ), Reference< XInterface >() ); m_bHasSeekable = sal_True; @@ -157,15 +157,15 @@ uno::Reference< io::XInputStream >& ZipPackageStream::GetOwnSeekStream() uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCopy() { if ( m_nStreamMode != PACKAGE_STREAM_RAW || !GetOwnSeekStream().is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( xEncryptionData.isEmpty() ) - throw ZipIOException( OUString::createFromAscii( "Encrypted stream without encryption data!\n" ), + throw ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Encrypted stream without encryption data!\n" ) ), Reference< XInterface >() ); uno::Reference< io::XSeekable > xSeek( GetOwnSeekStream(), UNO_QUERY ); if ( !xSeek.is() ) - throw ZipIOException( OUString::createFromAscii( "The stream must be seekable!\n" ), + throw ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "The stream must be seekable!\n" ) ), Reference< XInterface >() ); // skip header @@ -174,12 +174,12 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop // create temporary stream uno::Reference < io::XOutputStream > xTempOut( - m_xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + m_xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ), uno::UNO_QUERY ); uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY ); uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY ); if ( !xTempOut.is() || !xTempIn.is() || !xTempSeek.is() ) - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // copy the raw stream to the temporary file starting from the current position ::comphelper::OStorageHelper::CopyInputToOutput( GetOwnSeekStream(), xTempOut ); @@ -193,7 +193,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_Bool bAddHeaderForEncr ) { if ( m_nStreamMode != PACKAGE_STREAM_DATA || !GetOwnSeekStream().is() || (bAddHeaderForEncr && !bToBeEncrypted) ) - throw packages::NoEncryptionException(); // TODO + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); Sequence< sal_Int8 > aKey; @@ -202,23 +202,23 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B aKey = ( xEncryptionData.isEmpty() || !bHaveOwnKey ) ? rZipPackage.getEncryptionKey() : xEncryptionData->aKey; if ( !aKey.getLength() ) - throw packages::NoEncryptionException(); // TODO + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } try { // create temporary file uno::Reference < io::XStream > xTempStream( - m_xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + m_xFactory->createInstance ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ), uno::UNO_QUERY ); if ( !xTempStream.is() ) - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // create a package based on it ZipPackage* pPackage = new ZipPackage( m_xFactory ); Reference< XSingleServiceFactory > xPackageAsFactory( static_cast< XSingleServiceFactory* >( pPackage ) ); if ( !xPackageAsFactory.is() ) - throw RuntimeException(); // TODO + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); Sequence< Any > aArgs( 1 ); aArgs[0] <<= xTempStream; @@ -227,7 +227,7 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B // create a new package stream Reference< XDataSinkEncrSupport > xNewPackStream( xPackageAsFactory->createInstance(), UNO_QUERY ); if ( !xNewPackStream.is() ) - throw RuntimeException(); // TODO + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !m_aSharedMutexRef.Is() ) m_aSharedMutexRef = new SotMutexHolder(); @@ -236,27 +236,27 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY ); if ( !xNewPSProps.is() ) - throw RuntimeException(); // TODO + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // copy all the properties of this stream to the new stream - xNewPSProps->setPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ), makeAny( sMediaType ) ); - xNewPSProps->setPropertyValue( ::rtl::OUString::createFromAscii( "Compressed" ), makeAny( bToBeCompressed ) ); + xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ), makeAny( sMediaType ) ); + xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Compressed" ) ), makeAny( bToBeCompressed ) ); if ( bToBeEncrypted ) { - xNewPSProps->setPropertyValue( ::rtl::OUString::createFromAscii( "EncryptionKey" ), makeAny( aKey ) ); - xNewPSProps->setPropertyValue( ::rtl::OUString::createFromAscii( "Encrypted" ), makeAny( sal_True ) ); + xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ), makeAny( aKey ) ); + xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Encrypted" ) ), makeAny( sal_True ) ); } // insert a new stream in the package Reference< XUnoTunnel > xTunnel; - Any aRoot = pPackage->getByHierarchicalName( ::rtl::OUString::createFromAscii( "/" ) ); + Any aRoot = pPackage->getByHierarchicalName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) ); aRoot >>= xTunnel; Reference< container::XNameContainer > xRootNameContainer( xTunnel, UNO_QUERY ); if ( !xRootNameContainer.is() ) - throw RuntimeException(); // TODO + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); Reference< XUnoTunnel > xNPSTunnel( xNewPackStream, UNO_QUERY ); - xRootNameContainer->insertByName( ::rtl::OUString::createFromAscii( "dummy" ), makeAny( xNPSTunnel ) ); + xRootNameContainer->insertByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "dummy" ) ), makeAny( xNPSTunnel ) ); // commit the temporary package pPackage->commitChanges(); @@ -270,12 +270,12 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B // create another temporary file uno::Reference < io::XOutputStream > xTempOut( - m_xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + m_xFactory->createInstance ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ), uno::UNO_QUERY ); uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY ); uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY ); if ( !xTempOut.is() || !xTempIn.is() || !xTempSeek.is() ) - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // copy the raw stream to the temporary file ::comphelper::OStorageHelper::CopyInputToOutput( xInRaw, xTempOut ); @@ -301,7 +301,7 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B { } - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } //-------------------------------------------------------------------------- @@ -472,7 +472,7 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream() // this method can not be used together with old approach if ( m_nStreamMode == PACKAGE_STREAM_DETECT ) - throw packages::zip::ZipIOException(); // TODO + throw packages::zip::ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !xEncryptionData.isEmpty() && !bHaveOwnKey ) xEncryptionData->aKey = rZipPackage.getEncryptionKey(); @@ -508,12 +508,12 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream() // this method can not be used together with old approach if ( m_nStreamMode == PACKAGE_STREAM_DETECT ) - throw packages::zip::ZipIOException(); // TODO + throw packages::zip::ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if (IsPackageMember()) { if ( !bIsEncrypted || xEncryptionData.isEmpty() ) - throw packages::NoEncryptionException(); // TODO + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return rZipPackage.getZipFile().getWrappedRawStream( aEntry, xEncryptionData, sMediaType ); } @@ -529,7 +529,7 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream() return TryToGetRawFromDataStream( sal_True ); } - throw packages::NoEncryptionException(); // TODO + throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } @@ -553,7 +553,7 @@ void SAL_CALL ZipPackageStream::setRawStream( const Reference< io::XInputStream Reference< io::XInputStream > xNewStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( aStream, m_xFactory ); Reference< io::XSeekable > xSeek( xNewStream, UNO_QUERY ); if ( !xSeek.is() ) - throw RuntimeException( OUString::createFromAscii( "The stream must support XSeekable!" ), + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "The stream must support XSeekable!" ) ), Reference< XInterface >() ); xSeek->seek( 0 ); @@ -562,7 +562,7 @@ void SAL_CALL ZipPackageStream::setRawStream( const Reference< io::XInputStream if ( !ParsePackageRawStream() ) { xStream = xOldStream; - throw packages::NoRawFormatException(); + throw packages::NoRawFormatException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } // the raw stream MUST have seekable access @@ -585,7 +585,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream( // this method can not be used together with old approach if ( m_nStreamMode == PACKAGE_STREAM_DETECT ) - throw packages::zip::ZipIOException(); // TODO + throw packages::zip::ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if (IsPackageMember()) { @@ -626,7 +626,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaType"))) { if ( rZipPackage.getFormat() != PACKAGE_FORMAT && rZipPackage.getFormat() != OFOPXML_FORMAT ) - throw beans::PropertyVetoException(); + throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( aValue >>= sMediaType ) { @@ -640,7 +640,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, } } else - throw IllegalArgumentException( OUString::createFromAscii( "MediaType must be a string!\n" ), + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "MediaType must be a string!\n" ) ), Reference< XInterface >(), 2 ); @@ -648,21 +648,21 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Size") ) ) { if ( !( aValue >>= aEntry.nSize ) ) - throw IllegalArgumentException( OUString::createFromAscii( "Wrong type for Size property!\n" ), + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for Size property!\n" ) ), Reference< XInterface >(), 2 ); } else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Encrypted") ) ) { if ( rZipPackage.getFormat() != PACKAGE_FORMAT ) - throw beans::PropertyVetoException(); + throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); sal_Bool bEnc = sal_False; if ( aValue >>= bEnc ) { // In case of new raw stream, the stream must not be encrypted on storing if ( bEnc && m_nStreamMode == PACKAGE_STREAM_RAW ) - throw IllegalArgumentException( OUString::createFromAscii( "Raw stream can not be encrypted on storing" ), + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Raw stream can not be encrypted on storing" ) ), Reference< XInterface >(), 2 ); @@ -671,7 +671,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, xEncryptionData = new EncryptionData; } else - throw IllegalArgumentException( OUString::createFromAscii( "Wrong type for Encrypted property!\n" ), + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for Encrypted property!\n" ) ), Reference< XInterface >(), 2 ); @@ -679,7 +679,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) ) { if ( rZipPackage.getFormat() != PACKAGE_FORMAT ) - throw beans::PropertyVetoException(); + throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); Sequence < sal_Int8 > aNewKey; @@ -697,7 +697,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, aNewKey = aSequence; } else - throw IllegalArgumentException( OUString::createFromAscii( "Wrong type for EncryptionKey property!\n" ), + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for EncryptionKey property!\n" ) ), Reference< XInterface >(), 2 ); } @@ -724,7 +724,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, { // In case of new raw stream, the stream must not be encrypted on storing if ( bCompr && m_nStreamMode == PACKAGE_STREAM_RAW ) - throw IllegalArgumentException( OUString::createFromAscii( "Raw stream can not be encrypted on storing" ), + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Raw stream can not be encrypted on storing" ) ), Reference< XInterface >(), 2 ); @@ -732,12 +732,12 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, m_bCompressedIsSetFromOutside = sal_True; } else - throw IllegalArgumentException( OUString::createFromAscii( "Wrong type for Compressed property!\n" ), + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for Compressed property!\n" ) ), Reference< XInterface >(), 2 ); } else - throw beans::UnknownPropertyException(); + throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } //-------------------------------------------------------------------------- @@ -776,7 +776,7 @@ Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName ) return aAny; } else - throw beans::UnknownPropertyException(); + throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } //-------------------------------------------------------------------------- diff --git a/package/source/zippackage/wrapstreamforshare.cxx b/package/source/zippackage/wrapstreamforshare.cxx index e11bbfbd100d..71a778e19f57 100644 --- a/package/source/zippackage/wrapstreamforshare.cxx +++ b/package/source/zippackage/wrapstreamforshare.cxx @@ -47,7 +47,7 @@ WrapStreamForShare::WrapStreamForShare( const uno::Reference< io::XInputStream > if ( !m_rMutexRef.Is() || !m_xInStream.is() || !m_xSeekable.is() ) { OSL_ENSURE( sal_False, "Wrong initialization of wrapping stream!\n" ); - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } } @@ -65,7 +65,7 @@ sal_Int32 SAL_CALL WrapStreamForShare::readBytes( uno::Sequence< sal_Int8 >& aDa ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( !m_xInStream.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); m_xSeekable->seek( m_nCurPos ); @@ -84,7 +84,7 @@ sal_Int32 SAL_CALL WrapStreamForShare::readSomeBytes( uno::Sequence< sal_Int8 >& ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( !m_xInStream.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); m_xSeekable->seek( m_nCurPos ); @@ -103,7 +103,7 @@ void SAL_CALL WrapStreamForShare::skipBytes( sal_Int32 nBytesToSkip ) ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( !m_xInStream.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); m_xSeekable->seek( m_nCurPos ); @@ -119,7 +119,7 @@ sal_Int32 SAL_CALL WrapStreamForShare::available() ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( !m_xInStream.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return m_xInStream->available(); } @@ -132,7 +132,7 @@ void SAL_CALL WrapStreamForShare::closeInput() ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( !m_xInStream.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the package is the owner so it will close the stream // m_xInStream->closeInput(); @@ -149,7 +149,7 @@ void SAL_CALL WrapStreamForShare::seek( sal_Int64 location ) ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( !m_xInStream.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // let stream implementation do all the checking m_xSeekable->seek( location ); @@ -164,7 +164,7 @@ sal_Int64 SAL_CALL WrapStreamForShare::getPosition() ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( !m_xInStream.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return m_nCurPos; } @@ -176,7 +176,7 @@ sal_Int64 SAL_CALL WrapStreamForShare::getLength() ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); if ( !m_xInStream.is() ) - throw io::IOException(); // TODO + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return m_xSeekable->getLength(); } diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx index 8859b88f56d6..c284956f117e 100644 --- a/package/source/zippackage/zipfileaccess.cxx +++ b/package/source/zippackage/zipfileaccess.cxx @@ -59,7 +59,7 @@ OZipFileAccess::OZipFileAccess( const uno::Reference< lang::XMultiServiceFactory , m_bDisposed( sal_False ) { if ( !xFactory.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } // ---------------------------------------------------------------- @@ -182,13 +182,13 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( m_pZipFile ) - throw uno::Exception(); // TODO: initialization is allowed only one time + throw uno::Exception( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // initialization is allowed only one time if ( !aArguments.getLength() ) - throw lang::IllegalArgumentException(); // TODO: + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); OSL_ENSURE( aArguments.getLength() == 1, "Too meny arguments are provided, only the first one will be used!\n" ); @@ -217,15 +217,15 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu xSeekable = uno::Reference< io::XSeekable >( m_xContentStream, uno::UNO_QUERY ); } else - throw lang::IllegalArgumentException(); // TODO: + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !m_xContentStream.is() ) - throw io::IOException(); // TODO: + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !xSeekable.is() ) { // TODO: after fwkbugfix02 is integrated a helper class can be used to make the stream seekable - throw io::IOException(); + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } // TODO: in case xSeekable is implemented on separated XStream implementation a wrapper is required @@ -245,21 +245,21 @@ uno::Any SAL_CALL OZipFileAccess::getByName( const ::rtl::OUString& aName ) ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !m_pZipFile ) - throw io::NotConnectedException(); + throw io::NotConnectedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); EntryHash::iterator aIter = m_pZipFile->GetEntryHash().find( aName ); if ( aIter == m_pZipFile->GetEntryHash().end() ) - throw container::NoSuchElementException(); + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Reference< io::XInputStream > xEntryStream( m_pZipFile->getDataStream( (*aIter).second, new EncryptionData(), sal_False ) ); if ( !xEntryStream.is() ) - throw uno::RuntimeException(); // TODO: + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return uno::makeAny ( xEntryStream ); } @@ -271,10 +271,10 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OZipFileAccess::getElementNames() ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !m_pZipFile ) - throw io::NotConnectedException(); + throw io::NotConnectedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); uno::Sequence< ::rtl::OUString > aNames( m_pZipFile->GetEntryHash().size() ); sal_Int32 nLen = 0; @@ -306,10 +306,10 @@ sal_Bool SAL_CALL OZipFileAccess::hasByName( const ::rtl::OUString& aName ) ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !m_pZipFile ) - throw io::NotConnectedException(); + throw io::NotConnectedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); EntryHash::iterator aIter = m_pZipFile->GetEntryHash().find( aName ); @@ -323,10 +323,10 @@ uno::Type SAL_CALL OZipFileAccess::getElementType() ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !m_pZipFile ) - throw io::NotConnectedException(); + throw io::NotConnectedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return getCppuType( ( const uno::Reference< io::XInputStream >* )NULL ); } @@ -338,10 +338,10 @@ sal_Bool SAL_CALL OZipFileAccess::hasElements() ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !m_pZipFile ) - throw io::NotConnectedException(); + throw io::NotConnectedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return ( m_pZipFile->GetEntryHash().size() != 0 ); } @@ -356,10 +356,10 @@ uno::Reference< io::XInputStream > SAL_CALL OZipFileAccess::getStreamByPattern( ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !m_pZipFile ) - throw io::NotConnectedException(); + throw io::NotConnectedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // Code to compare strings by patterns uno::Sequence< ::rtl::OUString > aPattern = GetPatternsFromString_Impl( aPatternString ); @@ -373,12 +373,12 @@ uno::Reference< io::XInputStream > SAL_CALL OZipFileAccess::getStreamByPattern( sal_False ) ); if ( !xEntryStream.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return xEntryStream; } } - throw container::NoSuchElementException(); + throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } // XComponent @@ -389,7 +389,7 @@ void SAL_CALL OZipFileAccess::dispose() ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( m_pListenersContainer ) { @@ -421,7 +421,7 @@ void SAL_CALL OZipFileAccess::addEventListener( const uno::Reference< lang::XEve ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( !m_pListenersContainer ) m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); @@ -435,7 +435,7 @@ void SAL_CALL OZipFileAccess::removeEventListener( const uno::Reference< lang::X ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); if ( m_pListenersContainer ) m_pListenersContainer->removeInterface( xListener ); |