diff options
author | Daniel Vogelheim <dvo@openoffice.org> | 2001-11-27 14:30:57 +0000 |
---|---|---|
committer | Daniel Vogelheim <dvo@openoffice.org> | 2001-11-27 14:30:57 +0000 |
commit | a4b615018ca80625a701cc8668aa70fabbda660e (patch) | |
tree | b448582bc063e4da920cc20acd13b8f130f7701f /xmloff | |
parent | 87be53f4a4e16fb2b8693c2dfdb84b27626d5caa (diff) |
#95226# Error reporting through debug message
Also eliminated false warnings (i.e. warnings even though nothing went wrong)
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlerror.cxx | 88 | ||||
-rw-r--r-- | xmloff/source/style/xmlimppr.cxx | 27 |
2 files changed, 108 insertions, 7 deletions
diff --git a/xmloff/source/core/xmlerror.cxx b/xmloff/source/core/xmlerror.cxx index dfe3819d160b..47fa9a9f339f 100644 --- a/xmloff/source/core/xmlerror.cxx +++ b/xmloff/source/core/xmlerror.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlerror.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dvo $ $Date: 2001-09-28 16:39:54 $ + * last change: $Author: dvo $ $Date: 2001-11-27 15:30:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,8 +92,18 @@ #endif +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.hxx> +#endif + +#ifndef _STRING_HXX +#include <tools/string.hxx> +#endif + + using ::rtl::OUString; +using ::rtl::OUStringBuffer; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; @@ -172,6 +182,80 @@ void XMLErrors::AddRecord( { aErrors.push_back( ErrorRecord( nId, rParams, rExceptionMessage, nRow, nColumn, rPublicId, rSystemId ) ); + +#ifndef PRODUCT + + // give detailed assertion on this message + + OUStringBuffer sMessage; + + sMessage.appendAscii( "An error or a warning has occured during XML import/export!\n" ); + + // ID & flags + sMessage.appendAscii( "Error-Id: 0x"); + sMessage.append( nId, 16 ); + sMessage.appendAscii( "\n Flags: " ); + sal_Int32 nFlags = (nId & XMLERROR_MASK_FLAG); + sMessage.append( nFlags >> 28, 16 ); + if( (nFlags & XMLERROR_FLAG_WARNING) != 0 ) + sMessage.appendAscii( " WARNING" ); + if( (nFlags & XMLERROR_FLAG_ERROR) != 0 ) + sMessage.appendAscii( " ERRROR" ); + if( (nFlags & XMLERROR_FLAG_SEVERE) != 0 ) + sMessage.appendAscii( " SEVERE" ); + sMessage.appendAscii( "\n Class: " ); + sal_Int32 nClass = (nId & XMLERROR_MASK_CLASS); + sMessage.append( nClass >> 16, 16 ); + if( (nClass & XMLERROR_CLASS_IO) != 0 ) + sMessage.appendAscii( " IO" ); + if( (nClass & XMLERROR_CLASS_FORMAT) != 0 ) + sMessage.appendAscii( " FORMAT" ); + if( (nClass & XMLERROR_CLASS_API) != 0 ) + sMessage.appendAscii( " API" ); + if( (nClass & XMLERROR_CLASS_OTHER) != 0 ) + sMessage.appendAscii( " OTHER" ); + sMessage.appendAscii( "\n Number: " ); + sal_Int32 nNumber = (nId & XMLERROR_MASK_NUMBER); + sMessage.append( nNumber, 16 ); + sMessage.appendAscii( "\n"); + + // the parameters + sMessage.appendAscii( "Parameters:\n" ); + sal_Int32 nLength = rParams.getLength(); + const OUString* pParams = rParams.getConstArray(); + for( sal_Int32 i = 0; i < nLength; i++ ) + { + sMessage.appendAscii( " " ); + sMessage.append( i ); + sMessage.appendAscii( ": " ); + sMessage.append( pParams[i] ); + sMessage.appendAscii( "\n" ); + } + + // the exception message + sMessage.appendAscii( "Exception-Message: " ); + sMessage.append( rExceptionMessage ); + sMessage.appendAscii( "\n" ); + + // position (if given) + if( (nRow != -1) || (nColumn != -1) ) + { + sMessage.appendAscii( "Position:\n Public Identifier: " ); + sMessage.append( rPublicId ); + sMessage.appendAscii( "\n System Identifier: " ); + sMessage.append( rSystemId ); + sMessage.appendAscii( "\n Row, Column: " ); + sMessage.append( nRow ); + sMessage.appendAscii( "," ); + sMessage.append( nColumn ); + sMessage.appendAscii( "\n" ); + } + + // convert to byte string and signal the error + ByteString aError( String( sMessage.makeStringAndClear() ), + RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR( aError.GetBuffer() ); +#endif } void XMLErrors::AddRecord( diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx index 6d175e7eac57..6c18865a1b3d 100644 --- a/xmloff/source/style/xmlimppr.cxx +++ b/xmloff/source/style/xmlimppr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlimppr.cxx,v $ * - * $Revision: 1.26 $ + * $Revision: 1.27 $ * - * last change: $Author: mib $ $Date: 2001-11-13 17:58:24 $ + * last change: $Author: dvo $ $Date: 2001-11-27 15:30:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -226,6 +226,11 @@ void SvXMLImportPropertyMapper::importXML( sal_Int32 nIndex = nStartIdx - 1; sal_uInt32 nFlags = 0; // flags of actual property map entry sal_Bool bFound = sal_False; + + // for better error reporting: this should be set true if no + // warning is needed + sal_Bool bNoWarning = sal_False; + do { // find an entry for this attribute @@ -270,10 +275,20 @@ void SvXMLImportPropertyMapper::importXML( } else { + sal_uInt32 nOldSize = rProperties.size(); + bSet = handleSpecialItem( aNewProperty, rProperties, rValue, rUnitConverter, rNamespaceMap ); + + // no warning if handleSpecialItem added properties + bNoWarning |= ( nOldSize != rProperties.size() ); } + + // no warning if we found could set the item. This + // 'remembers' bSet across multi properties. + bNoWarning |= bSet; + // store the property in the given vector if( bSet ) { @@ -284,9 +299,11 @@ void SvXMLImportPropertyMapper::importXML( } else { - // warn about unknown value (unless it's a - // multi property; then we get another chance) - if( (nFlags & MID_FLAG_MULTI_PROPERTY) == 0 ) + // warn about unknown value. Unless it's a + // multi property: Then we get another chance + // to set the value. + if( !bNoWarning && + ((nFlags & MID_FLAG_MULTI_PROPERTY) == 0) ) { Sequence<OUString> aSeq(2); aSeq[0] = rAttrName; |