From f9e6d195dbbf0b2effa10f69f4c99fce6e2b186b Mon Sep 17 00:00:00 2001 From: Marcel Metz Date: Sun, 15 Jan 2012 11:30:24 +0100 Subject: Replaced diagnore ENSURE_OR_BREAK with regular code. --- basctl/source/basicide/basobj2.cxx | 18 ++++++++++++--- svtools/source/contnr/svtreebx.cxx | 7 +++++- svtools/source/uno/svtxgridcontrol.cxx | 42 +++++++++++++++++++++++++++++----- svx/source/form/fmpgeimp.cxx | 6 ++++- ucb/source/ucp/ext/ucpext_content.cxx | 21 ++++++++++++++--- xmloff/source/forms/elementimport.cxx | 42 +++++++++++++++++++++++++++------- 6 files changed, 114 insertions(+), 22 deletions(-) diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index 646c40c5d9ed..36ee590f69f2 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -305,13 +305,25 @@ namespace break; SbModule* pModule = pMethod->GetModule(); - ENSURE_OR_BREAK( pModule, "BasicIDE::ChooseMacro: No Module found!" ); + if ( !pModule ) + { + SAL_WARN( "basctl.basicide", "BasicIDE::ChooseMacro: No Module found!" ); + break; + } StarBASIC* pBasic = dynamic_cast(pModule->GetParent()); - ENSURE_OR_BREAK( pBasic, "BasicIDE::ChooseMacro: No Basic found!" ); + if ( !pBasic ) + { + SAL_WARN( "basctl.basicide", "BasicIDE::ChooseMacro: No Basic found!" ); + break; + } BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); - ENSURE_OR_BREAK( pBasMgr, "BasicIDE::ChooseMacro: No BasicManager found!" ); + if ( !pBasMgr ) + { + SAL_WARN( "basctl.basicide", "BasicIDE::ChooseMacro: No BasicManager found!" ); + break; + } // name String aName; diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index 5fa9bde6b6f2..9bcbeb960071 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -2209,7 +2209,12 @@ void SvTreeListBox::ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry case LISTACTION_INSERTED: { SvLBoxEntry* pEntry( dynamic_cast< SvLBoxEntry* >( pEntry1 ) ); - ENSURE_OR_BREAK( pEntry, "SvTreeListBox::ModelNotification: invalid entry!" ); + if ( !pEntry ) + { + SAL_WARN( "svtools.contnr", "SvTreeListBox::ModelNotification: invalid entry!" ); + break; + } + SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry->GetFirstItem( SV_ITEM_ID_LBOXCONTEXTBMP ) ); if ( !pBmpItem ) break; diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index c6ce75f764ae..4cf1a854e3d2 100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -152,7 +152,12 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An { sal_Int32 rowHeaderWidth( -1 ); aValue >>= rowHeaderWidth; - ENSURE_OR_BREAK( rowHeaderWidth > 0, "SVTXGridControl::setProperty: illegal row header width!" ); + if ( rowHeaderWidth <= 0 ) + { + SAL_WARN( "svtools.uno", "SVTXGridControl::setProperty: illegal row header width!" ); + break; + } + m_pTableModel->setRowHeaderWidth( rowHeaderWidth ); // TODO: the model should broadcast this change itself, and the table should invalidate itself as needed pTable->Invalidate(); @@ -170,7 +175,12 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An { aValue >>= columnHeaderHeight; } - ENSURE_OR_BREAK( columnHeaderHeight > 0, "SVTXGridControl::setProperty: illegal column header height!" ); + if ( columnHeaderHeight <= 0 ) + { + SAL_WARN( "svtools.uno", "SVTXGridControl::setProperty: illegal column header width!" ); + break; + } + m_pTableModel->setColumnHeaderHeight( columnHeaderHeight ); // TODO: the model should broadcast this change itself, and the table should invalidate itself as needed pTable->Invalidate(); @@ -181,7 +191,12 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An { GridTableRenderer* pGridRenderer = dynamic_cast< GridTableRenderer* >( m_pTableModel->getRenderer().get() ); - ENSURE_OR_BREAK( pGridRenderer != NULL, "SVTXGridControl::setProperty(UseGridLines): invalid renderer!" ); + if ( !pGridRenderer ) + { + SAL_WARN( "svtools.uno", "SVTXGridControl::setProperty(UseGridLines): invalid renderer!" ); + break; + } + sal_Bool bUseGridLines = sal_False; OSL_VERIFY( aValue >>= bUseGridLines ); pGridRenderer->useGridLines( bUseGridLines ); @@ -201,7 +216,12 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An aValue >>= rowHeight; } m_pTableModel->setRowHeight( rowHeight ); - ENSURE_OR_BREAK( rowHeight > 0, "SVTXGridControl::setProperty: illegal row height!" ); + if ( rowHeight <= 0 ) + { + SAL_WARN( "svtools.uno", "SVTXGridControl::setProperty: illegal row height!" ); + break; + } + // TODO: the model should broadcast this change itself, and the table should invalidate itself as needed pTable->Invalidate(); } @@ -444,7 +464,12 @@ Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru { GridTableRenderer* pGridRenderer = dynamic_cast< GridTableRenderer* >( m_pTableModel->getRenderer().get() ); - ENSURE_OR_BREAK( pGridRenderer != NULL, "SVTXGridControl::getProperty(UseGridLines): invalid renderer!" ); + if ( !pGridRenderer ) + { + SAL_WARN( "svtools.uno", "SVTXGridControl::getProperty(UseGridLines): invalid renderer!" ); + break; + } + aPropertyValue <<= pGridRenderer->useGridLines(); } break; @@ -675,7 +700,12 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent case VCLEVENT_TABLEROW_SELECT: { TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); - ENSURE_OR_BREAK( pTable, "SVTXGridControl::ProcessWindowEvent: no control (anymore)!" ); + if ( !pTable ) + { + SAL_WARN( "svtools.uno", "SVTXGridControl::ProcessWindowEvent: no control (anymore)!" ); + break; + } + if ( m_aSelectionListeners.getLength() ) ImplCallItemListeners(); } diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index b71ed1c0f710..a0374016bf44 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -204,8 +204,12 @@ void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl ) bool bForeignIsForm = pForeignObj && ( pForeignObj->GetObjInventor() == FmFormInventor ); bool bOwnIsForm = pOwnObj && ( pOwnObj->GetObjInventor() == FmFormInventor ); - ENSURE_OR_BREAK( bForeignIsForm == bOwnIsForm, "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" ); + if ( bForeignIsForm != bOwnIsForm ) + { // if this fires, don't attempt to do further assignments, something's completely messed up + SAL_WARN( "svx.form", "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" ); + break; + } if ( !bForeignIsForm ) // no form control -> next round diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx index d9989edb1311..ed959bc74d4f 100644 --- a/ucb/source/ucp/ext/ucpext_content.cxx +++ b/ucb/source/ucp/ext/ucpext_content.cxx @@ -359,16 +359,31 @@ namespace ucb { namespace ucp { namespace ext const ::rtl::OUString sURL = m_xIdentifier->getContentIdentifier(); // cut the root URL - ENSURE_OR_BREAK( sURL.match( sRootURL, 0 ), "illegal URL structure - no root" ); + if ( !sURL.match( sRootURL, 0 ) ) + { + SAL_INFO( "ucb.ucp", "illegal URL structure - no root" ); + break; + } + ::rtl::OUString sRelativeURL( sURL.copy( sRootURL.getLength() ) ); // cut the extension ID const ::rtl::OUString sSeparatedExtensionId( encodeIdentifier( m_sExtensionId ) + ::rtl::OUString( sal_Unicode( '/' ) ) ); - ENSURE_OR_BREAK( sRelativeURL.match( sSeparatedExtensionId ), "illegal URL structure - no extension ID" ); + if ( !sRelativeURL.match( sSeparatedExtensionId ) ) + { + SAL_INFO( "ucb.ucp", "illegal URL structure - no extension ID" ); + break; + } + sRelativeURL = sRelativeURL.copy( sSeparatedExtensionId.getLength() ); // cut the final slash (if any) - ENSURE_OR_BREAK( !sRelativeURL.isEmpty(), "illegal URL structure - ExtensionContent should have a level below the extension ID" ); + if ( sRelativeURL.isEmpty() ) + { + SAL_INFO( "ucb.ucp", "illegal URL structure - ExtensionContent should have a level below the extension ID" ); + break; + } + if ( sRelativeURL.getStr()[ sRelativeURL.getLength() - 1 ] == '/' ) sRelativeURL = sRelativeURL.copy( 0, sRelativeURL.getLength() - 1 ); diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 2450478d817a..989214c0c623 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -574,9 +574,18 @@ namespace xmloff { const PropertyDescriptionList& rProperties( *pos ); const PropertyDescription* first = *rProperties.begin(); - ENSURE_OR_BREAK( first != NULL, "OElementImport::handleAttribute: invalid property description!" ); + if ( !first ) + { + SAL_WARN( "xmloff.forms", "OElementImport::handleAttribute: invalid property description!" ); + break; + } + const PPropertyHandler handler = (*first->factory)( first->propertyId ); - ENSURE_OR_BREAK( handler.get() != NULL, "OElementImport::handleAttribute: invalid property handler!" ); + if ( !handler.get() ) + { + SAL_WARN( "xmloff.forms", "OElementImport::handleAttribute: invalid property handler!" ); + break; + } PropertyValues aValues; for ( PropertyDescriptionList::const_iterator propDesc = rProperties.begin(); @@ -894,13 +903,25 @@ namespace xmloff if (!bRetrievedValues) { getValuePropertyNames(m_eElementType, nClassId, pCurrentValueProperty, pValueProperty); - ENSURE_OR_BREAK( pCurrentValueProperty || pValueProperty, "OControlImport::StartElement: illegal value property names!" ); + if ( !pCurrentValueProperty && !pValueProperty ) + { + SAL_WARN( "xmloff.forms", "OControlImport::StartElement: illegal value property names!" ); + break; + } + bRetrievedValues = sal_True; } - ENSURE_OR_BREAK((PROPID_VALUE != aValueProps->Handle) || pValueProperty, - "OControlImport::StartElement: the control does not have a value property!"); - ENSURE_OR_BREAK((PROPID_CURRENT_VALUE != aValueProps->Handle) || pCurrentValueProperty, - "OControlImport::StartElement: the control does not have a current-value property!"); + if ( PROPID_VALUE == aValueProps->Handle && !pValueProperty ) + { + SAL_WARN( "xmloff.forms", "OControlImport::StartElement: the control does not have a value property!"); + break; + } + + if ( PROPID_CURRENT_VALUE == aValueProps->Handle && !pCurrentValueProperty ) + { + SAL_WARN( "xmloff.forms", "OControlImport::StartElement: the control does not have a current-value property!"); + break; + } // transfer the name if (PROPID_VALUE == aValueProps->Handle) @@ -917,7 +938,12 @@ namespace xmloff if (!bRetrievedValueLimits) { getValueLimitPropertyNames(nClassId, pMinValueProperty, pMaxValueProperty); - ENSURE_OR_BREAK( pMinValueProperty && pMaxValueProperty, "OControlImport::StartElement: illegal value limit property names!" ); + if ( !pMinValueProperty || !pMaxValueProperty ) + { + SAL_WARN( "xmloff.forms", "OControlImport::StartElement: illegal value limit property names!" ); + break; + } + bRetrievedValueLimits = sal_True; } OSL_ENSURE((PROPID_MIN_VALUE != aValueProps->Handle) || pMinValueProperty, -- cgit