Kaydet (Commit) b20e7e1d authored tarafından Radu Ioan's avatar Radu Ioan Kaydeden (comit) Miklos Vajna

fdo#43157 - Clean up OSL_ASSERT

 - replaced osl_trace with sal_info
 - added new log areas to log-area.dox

Change-Id: I41444e90a22bad7d04d3827914d4d793b3601304
Signed-off-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
üst 88156809
......@@ -302,6 +302,14 @@ certain functionality.
@li @c xmlsecurity.helper
@li @c xmlsecurity.xmlsec - xmlsec wrapper
@section xmlscript
@li @c xmlscript.xmlhelper
@li @c xmlscript.xmldlg
@li @c xmlscript.xmlflat
@li @c xmlscript.xmllib
@li @c xmlscript.xmlmod
@section dbaccess
@li @c dbaccess
......
......@@ -263,7 +263,7 @@ inline sal_Int32 DocumentHandlerImpl::getUidByPrefix(
if (iFind != m_prefixes.end())
{
const PrefixEntry & rPrefixEntry = *iFind->second;
OSL_ASSERT( ! rPrefixEntry.m_Uids.empty() );
SAL_WARN_IF( rPrefixEntry.m_Uids.empty(), "xmlscript.xmlhelper", "rPrefixEntry.m_Uids is empty" );
m_nLastPrefix_lookup = rPrefixEntry.m_Uids.back();
m_aLastPrefix_lookup = rPrefix;
}
......@@ -294,7 +294,7 @@ inline void DocumentHandlerImpl::pushPrefix(
else
{
PrefixEntry * pEntry = iFind->second;
OSL_ASSERT( ! pEntry->m_Uids.empty() );
SAL_WARN_IF( pEntry->m_Uids.empty(), "xmlscript.xmlhelper", "pEntry->m_Uids is empty" );
pEntry->m_Uids.push_back( nUid );
}
......@@ -481,7 +481,7 @@ sal_Int32 DocumentHandlerImpl::getUidByUri( OUString const & Uri )
throw (RuntimeException)
{
sal_Int32 uid = getUidByURI( Uri );
OSL_ASSERT( uid != UID_UNKNOWN );
SAL_WARN_IF( uid == UID_UNKNOWN, "xmlscript.xmlhelper", "uid UNKNOWN");
return uid;
}
......@@ -538,8 +538,7 @@ void DocumentHandlerImpl::startElement(
#if OSL_DEBUG_LEVEL > 1
OString aQName(
OUStringToOString( rQElementName, RTL_TEXTENCODING_ASCII_US ) );
OSL_TRACE( "### no context given on createChildElement() "
"=> ignoring element \"%s\" ...", aQName.getStr() );
SAL_INFO("xmlscript.xmlhelper", "### no context given on createChildElement() => ignoring element \"" << aQName.getStr() << "\" ...");
#endif
return;
}
......@@ -595,9 +594,7 @@ void DocumentHandlerImpl::startElement(
if (pUids[ nPos ] >= 0) // no xmlns: attribute
{
OUString const & rQAttributeName = pQNames[ nPos ];
OSL_ENSURE(
!rQAttributeName.startsWith( "xmlns:" ),
"### unexpected xmlns!" );
SAL_WARN_IF(rQAttributeName.startsWith( "xmlns:" ), "xmlscript.xmlhelper", "### unexpected xmlns!" );
// collect attribute's uid and current prefix
sal_Int32 nColonPos = rQAttributeName.indexOf( (sal_Unicode) ':' );
......@@ -651,9 +648,7 @@ void DocumentHandlerImpl::startElement(
#if OSL_DEBUG_LEVEL > 1
OString aQName(
OUStringToOString( rQElementName, RTL_TEXTENCODING_ASCII_US ) );
OSL_TRACE(
"### no context given on createChildElement() => "
"ignoring element \"%s\" ...", aQName.getStr() );
SAL_INFO("xmlscript.xmlhelper", "### no context given on createChildElement() => ignoring element \"" << aQName.getStr() << "\" ...");
#endif
}
}
......@@ -673,14 +668,14 @@ void DocumentHandlerImpl::endElement(
#if OSL_DEBUG_LEVEL > 1
OString aQName(
OUStringToOString( rQElementName, RTL_TEXTENCODING_ASCII_US ) );
OSL_TRACE( "### received endElement() for \"%s\".", aQName.getStr() );
SAL_INFO("xmlscript.xmlhelper", "### received endElement() for \"" << aQName.getStr() << "\".");
#endif
static_cast<void>(rQElementName);
return;
}
// popping context
OSL_ASSERT( ! m_elements.empty() );
SAL_WARN_IF( m_elements.empty(), "xmlscript.xmlhelper", "m_elements is empty" );
ElementEntry * pEntry = m_elements.back();
xCurrentElement = pEntry->m_xElement;
......@@ -688,8 +683,8 @@ void DocumentHandlerImpl::endElement(
sal_Int32 nUid;
OUString aLocalName;
getElementName( rQElementName, &nUid, &aLocalName );
OSL_ASSERT( xCurrentElement->getLocalName() == aLocalName );
OSL_ASSERT( xCurrentElement->getUid() == nUid );
SAL_WARN_IF( xCurrentElement->getLocalName() != aLocalName, "xmlscript.xmlhelper", "xCurrentElement->getLocalName() != aLocalName" );
SAL_WARN_IF( xCurrentElement->getUid() != nUid, "xmlscript.xmlhelper", "xCurrentElement->getUid() != nUid" );
#endif
// pop prefixes
......@@ -792,7 +787,7 @@ OUString ExtendedAttributes::getTypeByIndex( sal_Int32 nIndex )
throw (RuntimeException)
{
static_cast<void>(nIndex);
OSL_ASSERT( nIndex < m_nAttributes );
SAL_WARN_IF( nIndex >= m_nAttributes , "xmlscript.xmlhelper", "nIndex is bigger then m_nAttributes");
return OUString(); // unsupported
}
......@@ -856,7 +851,7 @@ Reference< xml::sax::XDocumentHandler > SAL_CALL createDocumentHandler(
bool bSingleThreadedUse )
SAL_THROW(())
{
OSL_ASSERT( xRoot.is() );
SAL_WARN_IF( !xRoot.is(), "xmlscript.xmlhelper", "xRoot is NULL" );
if (xRoot.is())
{
return static_cast< xml::sax::XDocumentHandler * >(
......
......@@ -65,7 +65,7 @@ Reference< xml::input::XElement > Frame::startChildElement(
}
else
{
OSL_TRACE("****** ARGGGGG!!!! **********");
SAL_INFO("xmlscript.xmldlg","****** ARGGGGG!!!! **********");
throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
}
}
......@@ -574,7 +574,7 @@ void FormattedFieldElement::endElement()
}
catch (const util::MalformedNumberFormatException & exc)
{
OSL_FAIL( "### util::MalformedNumberFormatException occurred!" );
SAL_WARN( "xmlscript.xmldlg", "### util::MalformedNumberFormatException occurred!" );
// rethrow
throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() );
}
......@@ -1121,7 +1121,7 @@ void TextFieldElement::endElement()
OUString aValue;
if (getStringAttr( &aValue, "echochar", _xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !aValue.isEmpty() )
{
OSL_ENSURE( aValue.getLength() == 1, "### more than one character given for echochar!" );
SAL_WARN_IF( aValue.getLength() != 1, "xmlscript.xmldlg", "### more than one character given for echochar!" );
sal_Int16 nChar = (sal_Int16)aValue[ 0 ];
xControlModel->setPropertyValue( "EchoChar", makeAny( nChar ) );
}
......@@ -1377,7 +1377,7 @@ Reference< xml::input::XElement > MenuPopupElement::startChildElement(
else if ( rLocalName == "menuitem" )
{
OUString aValue( xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID,"value" ) );
OSL_ENSURE( !aValue.isEmpty(), "### menuitem has no value?" );
SAL_WARN_IF( aValue.isEmpty(), "xmlscript.xmldlg", "### menuitem has no value?" );
if (!aValue.isEmpty())
{
_itemValues.push_back( aValue );
......
......@@ -1478,7 +1478,7 @@ void ImportContext::importEvents(
}
else // script:listener-event element
{
OSL_ASSERT( aLocalName == "listener-event" );
SAL_WARN_IF( aLocalName != "listener-event", "xmlscript.xmldlg", "aLocalName != listener-event" );
if (!getStringAttr( &descr.ListenerType, "listener-type" , xAttributes, _pImport->XMLNS_SCRIPT_UID ) ||
!getStringAttr( &descr.EventMethod , "listener-method", xAttributes, _pImport->XMLNS_SCRIPT_UID ))
......@@ -1491,7 +1491,7 @@ void ImportContext::importEvents(
}
else // deprecated dlg:event element
{
OSL_ASSERT( _pImport->XMLNS_DIALOGS_UID == nUid && aLocalName == "event" );
SAL_WARN_IF( _pImport->XMLNS_DIALOGS_UID != nUid || aLocalName != "event", "xmlscript.xmldlg", "_pImport->XMLNS_DIALOGS_UID != nUid || aLocalName != \"event\"" );
if (!getStringAttr( &descr.ListenerType, "listener-type", xAttributes, _pImport->XMLNS_DIALOGS_UID ) ||
!getStringAttr( &descr.EventMethod, "event-method", xAttributes, _pImport->XMLNS_DIALOGS_UID ))
......@@ -1682,7 +1682,7 @@ ElementBase::~ElementBase()
#if OSL_DEBUG_LEVEL > 1
OString aStr( OUStringToOString(
_aLocalName, RTL_TEXTENCODING_ASCII_US ) );
OSL_TRACE( "ElementBase::~ElementBase(): %s", aStr.getStr() );
SAL_INFO("xmlscript.xmldlg", "ElementBase::~ElementBase(): " << aStr.getStr() );
#endif
}
......@@ -1744,7 +1744,7 @@ DialogImport::~DialogImport()
SAL_THROW(())
{
#if OSL_DEBUG_LEVEL > 1
OSL_TRACE( "DialogImport::~DialogImport()." );
SAL_INFO("xmlscript.xmldlg", "DialogImport::~DialogImport()." );
#endif
}
//__________________________________________________________________________________________________
......
......@@ -243,7 +243,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
xPSet->getPropertyValue("BasicLibraries" ) >>= xLibContainer;
}
OSL_ENSURE( xLibContainer.is(), "XMLBasicExporterBase::filter: nowhere to export to!" );
SAL_WARN_IF( !xLibContainer.is(), "xmlscript.xmlflat", "XMLBasicExporterBase::filter: nowhere to export to!" );
if ( xLibContainer.is() )
{
......@@ -398,26 +398,22 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
}
catch ( const container::NoSuchElementException& e )
{
OSL_TRACE( "XMLBasicExporterBase::filter: caught NoSuchElementException reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "XMLBasicExporterBase::filter: caught NoSuchElementException reason " << e.Message );
bReturn = sal_False;
}
catch ( const lang::IllegalArgumentException& e )
{
OSL_TRACE( "XMLBasicExporterBase::filter: caught IllegalArgumentException reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "XMLBasicExporterBase::filter: caught IllegalArgumentException reason " << e.Message );
bReturn = sal_False;
}
catch ( const lang::WrappedTargetException& e )
{
OSL_TRACE( "XMLBasicExporterBase::filter: caught WrappedTargetException reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "XMLBasicExporterBase::filter: caught WrappedTargetException reason " << e.Message );
bReturn = sal_False;
}
catch ( const xml::sax::SAXException& e )
{
OSL_TRACE( "XMLBasicExporterBase::filter: caught SAXException reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "XMLBasicExporterBase::filter: caught SAXException reason " << e.Message );
bReturn = sal_False;
}
......
......@@ -221,13 +221,11 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
}
catch ( const container::ElementExistException& e )
{
OSL_TRACE( "BasicLibrariesElement::startChildElement: caught ElementExceptionExist reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "BasicLibrariesElement::startChildElement: caught ElementExceptionExist reason " << e.Message );
}
catch ( const lang::IllegalArgumentException& e )
{
OSL_TRACE( "BasicLibrariesElement::startChildElement: caught IllegalArgumentException reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "BasicLibrariesElement::startChildElement: caught IllegalArgumentException reason " << e.Message );
}
}
}
......@@ -263,8 +261,7 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
}
catch ( const lang::IllegalArgumentException& e )
{
OSL_TRACE( "BasicLibrariesElement::startChildElement: caught IllegalArgumentException reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "BasicLibrariesElement::startChildElement: caught IllegalArgumentException reason " << e.Message );
}
}
}
......@@ -306,8 +303,7 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
}
catch ( const lang::WrappedTargetException& e )
{
OSL_TRACE( "BasicEmbeddedLibraryElement CTOR: caught WrappedTargetException reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "BasicEmbeddedLibraryElement CTOR: caught WrappedTargetException reason " << e.Message );
}
}
......@@ -451,18 +447,15 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
}
catch ( const container::ElementExistException& e )
{
OSL_TRACE( "BasicSourceCodeElement::endElement: caught ElementExceptionExist reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "BasicSourceCodeElement::endElement: caught ElementExceptionExist reason " << e.Message );
}
catch ( const lang::IllegalArgumentException& e )
{
OSL_TRACE( "BasicSourceCodeElement::endElement: caught IllegalArgumentException reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "BasicSourceCodeElement::endElement: caught IllegalArgumentException reason " << e.Message );
}
catch ( const lang::WrappedTargetException& e )
{
OSL_TRACE( "BasicSourceCodeElement::endElement: caught WrappedTargetException reason %s",
OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
SAL_INFO("xmlscript.xmlflat", "BasicSourceCodeElement::endElement: caught WrappedTargetException reason " << e.Message );
}
}
......@@ -552,7 +545,7 @@ void BasicImport::setDocumentLocator( const Reference< xml::sax::XLocator >& /*x
xPSet->getPropertyValue("BasicLibraries" ) >>= xLibContainer;
}
OSL_ENSURE( xLibContainer.is(), "BasicImport::startRootElement: nowhere to import to!" );
SAL_WARN_IF( !xLibContainer.is(), "xmlscript.xmlflat", "BasicImport::startRootElement: nowhere to import to!" );
if ( xLibContainer.is() )
{
......
......@@ -114,7 +114,7 @@ LibElementBase::~LibElementBase()
#if OSL_DEBUG_LEVEL > 1
OString aStr( OUStringToOString( _aLocalName, RTL_TEXTENCODING_ASCII_US ) );
OSL_TRACE( "LibElementBase::~LibElementBase(): %s", aStr.getStr() );
SAL_INFO("xmlscript.xmllib", "LibElementBase::~LibElementBase(): " << aStr.getStr() );
#endif
}
......@@ -183,7 +183,7 @@ LibraryImport::~LibraryImport()
SAL_THROW(())
{
#if OSL_DEBUG_LEVEL > 1
OSL_TRACE( "LibraryImport::~LibraryImport()." );
SAL_INFO("xmlscript.xmllib", "LibraryImport::~LibraryImport()." );
#endif
}
......
......@@ -114,7 +114,7 @@ ModuleElement::~ModuleElement()
#if OSL_DEBUG_LEVEL > 1
OString aStr( OUStringToOString( _aLocalName, RTL_TEXTENCODING_ASCII_US ) );
OSL_TRACE( "ModuleElement::~ModuleElement(): %s", aStr.getStr() );
SAL_INFO("xmlscript.xmlmod", "ModuleElement::~ModuleElement(): " << aStr.getStr() );
#endif
}
......@@ -179,7 +179,7 @@ ModuleImport::~ModuleImport()
SAL_THROW(())
{
#if OSL_DEBUG_LEVEL > 1
OSL_TRACE( "ModuleImport::~ModuleImport()." );
SAL_INFO("xmlscript.xmlmod", "ModuleImport::~ModuleImport()." );
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment