From 9a8e2d09bc2111371f149498481dd422b86f9b68 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 8 Sep 2013 23:00:27 +0300 Subject: Use SAL_WARN_IF instead of framework's home-grown LOG_ASSERT(2) Also remove declarations for debug function that don't exist (have been removed (misguidedly?) as unused perhaps). Change-Id: I0bc3320c52b3d50dc851a07fdc30b593cc4856b1 --- .../accelerators/acceleratorconfiguration.cxx | 2 +- framework/source/dispatch/dispatchprovider.cxx | 2 +- framework/source/dispatch/menudispatcher.cxx | 50 ++-------------------- framework/source/dispatch/popupmenudispatcher.cxx | 2 +- framework/source/fwe/classes/addonmenu.cxx | 1 - framework/source/fwe/classes/bmkmenu.cxx | 1 - .../source/fwi/classes/protocolhandlercache.cxx | 2 +- .../source/fwi/threadhelp/transactionmanager.cxx | 8 ++-- framework/source/helper/ocomponentaccess.cxx | 6 +-- framework/source/helper/ocomponentenumeration.cxx | 8 +--- framework/source/helper/oframes.cxx | 23 ++++------ framework/source/services/autorecovery.cxx | 4 +- framework/source/services/desktop.cxx | 46 ++++---------------- framework/source/services/frame.cxx | 46 ++++++++------------ framework/source/services/pathsettings.cxx | 4 +- framework/source/services/substitutepathvars.cxx | 2 +- framework/source/services/tabwindowservice.cxx | 2 +- framework/source/services/urltransformer.cxx | 2 +- 18 files changed, 58 insertions(+), 153 deletions(-) (limited to 'framework/source') diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 546fc66a2728..387451e7c414 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -94,7 +94,7 @@ XMLBasedAcceleratorConfiguration::XMLBasedAcceleratorConfiguration(const css::un //----------------------------------------------- XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration() { - LOG_ASSERT(!m_pWriteCache, "XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration()\nChanges not flushed. Ignore it ...") + SAL_WARN_IF(m_pWriteCache, "fwk", "XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration(): Changes not flushed. Ignore it ..."); } //----------------------------------------------- diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx index b10ed338815e..4fddddafc043 100644 --- a/framework/source/dispatch/dispatchprovider.cxx +++ b/framework/source/dispatch/dispatchprovider.cxx @@ -510,7 +510,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_searchProt if (xInit.is()) { css::uno::Reference< css::frame::XFrame > xOwner( m_xFrame.get(), css::uno::UNO_QUERY ); - LOG_ASSERT(xOwner.is(), "DispatchProvider::implts_searchProtocolHandler()\nCouldn't get reference to my owner frame. So I can't set may needed context information for this protocol handler.") + SAL_WARN_IF(!xOwner.is(), "fwk", "DispatchProvider::implts_searchProtocolHandler(): Couldn't get reference to my owner frame. So I can't set may needed context information for this protocol handler."); if (xOwner.is()) { try diff --git a/framework/source/dispatch/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx index 0f01e2335b2e..751487af1cea 100644 --- a/framework/source/dispatch/menudispatcher.cxx +++ b/framework/source/dispatch/menudispatcher.cxx @@ -58,35 +58,12 @@ using namespace ::cppu ; const sal_uInt16 SLOTID_MDIWINDOWLIST = 5610; -//------------------------------------------------------------------------------------------------------------- -// debug methods -// (should be private everyway!) -//------------------------------------------------------------------------------------------------------------- - -/*-****************************************************************************************************//** - @short debug-method to check incoming parameter of some other mehods of this class - @descr The following methods are used to check parameters for other methods - of this class. The return value is used directly for an ASSERT(...). - - @seealso ASSERTs in implementation! - - @param css::uno::References to checking variables - @return sal_False on invalid parameter
- sal_True otherway - - @onerror - -*//*-*****************************************************************************************************/ - -#ifdef ENABLE_ASSERTIONS - static sal_Bool impldbg_checkParameter_MenuDispatcher ( const css::uno::Reference< css::uno::XComponentContext >& xContext , const css::uno::Reference< css::frame::XFrame >& xOwner ); static sal_Bool impldbg_checkParameter_addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl , const css::util::URL& aURL ); static sal_Bool impldbg_checkParameter_removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl , const css::util::URL& aURL ); -#endif // #ifdef ENABLE_ASSERTIONS - //***************************************************************************************************************** // constructor //***************************************************************************************************************** @@ -104,7 +81,7 @@ MenuDispatcher::MenuDispatcher( const uno::Reference< XComponentContext >& { // Safe impossible cases // We need valid information about our owner for work. - LOG_ASSERT( impldbg_checkParameter_MenuDispatcher( xContext, xOwner ), "MenuDispatcher::MenuDispatcher()\nInvalid parameter detected!\n" ) + SAL_WARN_IF( !impldbg_checkParameter_MenuDispatcher( xContext, xOwner ), "fwk", "MenuDispatcher::MenuDispatcher()\nInvalid parameter detected!" ); m_bActivateListener = sal_True; xOwner->addFrameActionListener( uno::Reference< XFrameActionListener >( (OWeakObject *)this, UNO_QUERY )); @@ -138,7 +115,7 @@ void SAL_CALL MenuDispatcher::addStatusListener( const uno::Reference< XStat ResetableGuard aGuard( m_aLock ); // Safe impossible cases // Method not defined for all incoming parameter - LOG_ASSERT( impldbg_checkParameter_addStatusListener( xControl, aURL ), "MenuDispatcher::addStatusListener()\nInvalid parameter detected.\n" ) + SAL_WARN_IF( !impldbg_checkParameter_addStatusListener( xControl, aURL ), "fwk", "MenuDispatcher::addStatusListener(): Invalid parameter detected." ); // Add listener to container. m_aListenerContainer.addInterface( aURL.Complete, xControl ); } @@ -153,7 +130,7 @@ void SAL_CALL MenuDispatcher::removeStatusListener( const uno::Reference< X ResetableGuard aGuard( m_aLock ); // Safe impossible cases // Method not defined for all incoming parameter - LOG_ASSERT( impldbg_checkParameter_removeStatusListener( xControl, aURL ), "MenuDispatcher::removeStatusListener()\nInvalid parameter detected.\n" ) + SAL_WARN_IF( !impldbg_checkParameter_removeStatusListener( xControl, aURL ), "fwk", "MenuDispatcher::removeStatusListener(): Invalid parameter detected." ); // Add listener to container. m_aListenerContainer.removeInterface( aURL.Complete, xControl ); } @@ -205,7 +182,7 @@ void SAL_CALL MenuDispatcher::disposing( const EventObject& ) throw( RuntimeExce // Ready for multithreading ResetableGuard aGuard( m_aLock ); // Safe impossible cases - LOG_ASSERT( !(m_bAlreadyDisposed==sal_True), "MenuDispatcher::disposing()\nObject already disposed .. don't call it again!\n" ) + SAL_WARN_IF( m_bAlreadyDisposed, "fwk", "MenuDispatcher::disposing(): Object already disposed .. don't call it again!" ); if( m_bAlreadyDisposed == sal_False ) { @@ -334,23 +311,6 @@ sal_Bool MenuDispatcher::impl_setMenuBar( MenuBar* pMenuBar, sal_Bool bMenuFromR return sal_False; } -//_________________________________________________________________________________________________________________ -// debug methods -//_________________________________________________________________________________________________________________ - -/*----------------------------------------------------------------------------------------------------------------- - The follow methods checks the parameter for other functions. If a parameter or his value is non valid, - we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT! - - ATTENTION - - If you miss a test for one of this parameters, contact the autor or add it himself !(?) - But ... look for right testing! See using of this methods! ------------------------------------------------------------------------------------------------------------------*/ - -#ifdef ENABLE_ASSERTIONS - -//***************************************************************************************************************** static sal_Bool impldbg_checkParameter_MenuDispatcher( const uno::Reference< XComponentContext >& xContext , const uno::Reference< XFrame >& xOwner ) { @@ -412,8 +372,6 @@ static sal_Bool impldbg_checkParameter_removeStatusListener( const uno::Refer return bOK ; } -#endif // #ifdef ENABLE_ASSERTIONS - } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx index 2503636ead85..c30629d78ff9 100644 --- a/framework/source/dispatch/popupmenudispatcher.cxx +++ b/framework/source/dispatch/popupmenudispatcher.cxx @@ -329,7 +329,7 @@ SAL_CALL PopupMenuDispatcher::disposing( const EventObject& ) throw( RuntimeExce // Ready for multithreading ResetableGuard aGuard( m_aLock ); // Safe impossible cases - LOG_ASSERT( !(m_bAlreadyDisposed==sal_True), "MenuDispatcher::disposing()\nObject already disposed .. don't call it again!\n" ) + SAL_WARN_IF( m_bAlreadyDisposed, "fwk", "MenuDispatcher::disposing(): Object already disposed .. don't call it again!" ); if( m_bAlreadyDisposed == sal_False ) { diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx index 871bfcabae2d..9a7af5c23e43 100644 --- a/framework/source/fwe/classes/addonmenu.cxx +++ b/framework/source/fwe/classes/addonmenu.cxx @@ -20,7 +20,6 @@ #include "framework/addonmenu.hxx" #include "framework/addonsoptions.hxx" #include -#include #include #include diff --git a/framework/source/fwe/classes/bmkmenu.cxx b/framework/source/fwe/classes/bmkmenu.cxx index dd2074fbafd1..b15c9f4f9908 100644 --- a/framework/source/fwe/classes/bmkmenu.cxx +++ b/framework/source/fwe/classes/bmkmenu.cxx @@ -21,7 +21,6 @@ #include "framework/bmkmenu.hxx" #include -#include #include #include diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx index 274613c9a74e..0f588a0421fc 100644 --- a/framework/source/fwi/classes/protocolhandlercache.cxx +++ b/framework/source/fwi/classes/protocolhandlercache.cxx @@ -231,7 +231,7 @@ void HandlerCFGAccess::read( HandlerHash** ppHandler , // get values at all css::uno::Sequence< css::uno::Any > lValues = GetProperties( lFullNames ); - LOG_ASSERT2( lFullNames.getLength()!=lValues.getLength(), "HandlerCFGAccess::read()", "Miss some configuration values of handler set!" ) + SAL_WARN_IF( lFullNames.getLength()!=lValues.getLength(), "fwk", "HandlerCFGAccess::read(): Miss some configuration values of handler set!" ); // fill structures nSource = 0; diff --git a/framework/source/fwi/threadhelp/transactionmanager.cxx b/framework/source/fwi/threadhelp/transactionmanager.cxx index c4075402c140..95297f5526d7 100644 --- a/framework/source/fwi/threadhelp/transactionmanager.cxx +++ b/framework/source/fwi/threadhelp/transactionmanager.cxx @@ -296,7 +296,7 @@ void TransactionManager::impl_throwExceptions( EExceptionMode eMode, ERejectReas case E_UNINITIALIZED : if( eMode == E_HARDEXCEPTIONS ) { // Help programmer to find out, why this exception is thrown! - LOG_ERROR( "TransactionManager...", "Owner instance not correctly initialized yet. Call was rejected! Normally it's an algorithm error ... wrong use of class!" ) + SAL_WARN( "fwk", "TransactionManager...: Owner instance not correctly initialized yet. Call was rejected! Normally it's an algorithm error ... wrong use of class!" ); //ATTENTION: temp. disabled - till all bad code positions are detected and changed! */ // throw css::uno::RuntimeException( DECLARE_ASCII("TransactionManager...\nOwner instance not right initialized yet. Call was rejected! Normaly it's an algorithm error ... wrong usin of class!\n" ), css::uno::Reference< css::uno::XInterface >() ); } @@ -304,18 +304,18 @@ void TransactionManager::impl_throwExceptions( EExceptionMode eMode, ERejectReas case E_INCLOSE : if( eMode == E_HARDEXCEPTIONS ) { // Help programmer to find out, why this exception is thrown! - LOG_ERROR( "TransactionManager...", "Owner instance stand in close method. Call was rejected!" ) + SAL_WARN( "fwk", "TransactionManager...: Owner instance stand in close method. Call was rejected!" ); throw css::lang::DisposedException( DECLARE_ASCII("TransactionManager...\nOwner instance stand in close method. Call was rejected!\n" ), css::uno::Reference< css::uno::XInterface >() ); } break; case E_CLOSED : { // Help programmer to find out, why this exception is thrown! - LOG_ERROR( "TransactionManager...", "Owner instance already closed. Call was rejected!" ) + SAL_WARN( "fwk", "TransactionManager...: Owner instance already closed. Call was rejected!" ); throw css::lang::DisposedException( DECLARE_ASCII("TransactionManager...\nOwner instance already closed. Call was rejected!\n" ), css::uno::Reference< css::uno::XInterface >() ); } case E_NOREASON : { // Help programmer to find out - LOG_ERROR( "TransactionManager...", "Impossible case E_NOREASON!" ) + SAL_WARN( "fwk", "TransactionManager...: Impossible case E_NOREASON!" ); } break; default: break; // nothing to do diff --git a/framework/source/helper/ocomponentaccess.cxx b/framework/source/helper/ocomponentaccess.cxx index 32cb0ac5bc98..85e62cd4ab28 100644 --- a/framework/source/helper/ocomponentaccess.cxx +++ b/framework/source/helper/ocomponentaccess.cxx @@ -46,7 +46,7 @@ OComponentAccess::OComponentAccess( const css::uno::Reference< XDesktop >& xOwne , m_xOwner ( xOwner ) { // Safe impossible cases - LOG_ASSERT( impldbg_checkParameter_OComponentAccessCtor( xOwner ), "OComponentAccess::OComponentAccess()\nInvalid parameter detected!\n" ) + SAL_WARN_IF( !impldbg_checkParameter_OComponentAccessCtor( xOwner ), "fwk", "OComponentAccess::OComponentAccess(): Invalid parameter detected!" ); } //***************************************************************************************************************** @@ -200,8 +200,6 @@ css::uno::Reference< XComponent > OComponentAccess::impl_getFrameComponent( cons But ... look for right testing! See using of this methods! -----------------------------------------------------------------------------------------------------------------*/ -#ifdef ENABLE_ASSERTIONS - //***************************************************************************************************************** sal_Bool OComponentAccess::impldbg_checkParameter_OComponentAccessCtor( const css::uno::Reference< XDesktop >& xOwner ) { @@ -219,8 +217,6 @@ sal_Bool OComponentAccess::impldbg_checkParameter_OComponentAccessCtor( const return bOK ; } -#endif // #ifdef ENABLE_ASSERTIONS - } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/helper/ocomponentenumeration.cxx b/framework/source/helper/ocomponentenumeration.cxx index 67c66e2a48e9..c1b3ea885973 100644 --- a/framework/source/helper/ocomponentenumeration.cxx +++ b/framework/source/helper/ocomponentenumeration.cxx @@ -49,7 +49,7 @@ OComponentEnumeration::OComponentEnumeration( const Sequence< css::uno::Referenc { // Safe impossible states // "Method" not defined for ALL parameters! - LOG_ASSERT( impldbg_checkParameter_OComponentEnumerationCtor( seqComponents ), "OComponentEnumeration::OComponentEnumeration()\nInvalid parameter detected!\n" ) + SAL_WARN_IF( !impldbg_checkParameter_OComponentEnumerationCtor( seqComponents ), "fwk", "OComponentEnumeration::OComponentEnumeration(): Invalid parameter detected!" ); } //***************************************************************************************************************** @@ -75,7 +75,7 @@ aEvent // Safe impossible cases // This method is not specified for all incoming parameters. - LOG_ASSERT( impldbg_checkParameter_disposing( aEvent ), "OComponentEnumeration::disposing()\nInvalid parameter detected!\n" ) + SAL_WARN_IF( !impldbg_checkParameter_disposing( aEvent ), "fwk", "OComponentEnumeration::disposing(): Invalid parameter detected!" ); // Reset instance to defaults, release references and free memory. impl_resetObject(); @@ -157,8 +157,6 @@ void OComponentEnumeration::impl_resetObject() But ... look for right testing! See using of this methods! -----------------------------------------------------------------------------------------------------------------*/ -#ifdef ENABLE_ASSERTIONS - //***************************************************************************************************************** // An empty list is allowed ... hasMoreElements() will return false then! sal_Bool OComponentEnumeration::impldbg_checkParameter_OComponentEnumerationCtor( const Sequence< css::uno::Reference< XComponent > >& seqComponents ) @@ -193,8 +191,6 @@ sal_Bool OComponentEnumeration::impldbg_checkParameter_disposing( const EventObj return bOK ; } -#endif // #ifdef ENABLE_ASSERTIONS - } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/helper/oframes.cxx b/framework/source/helper/oframes.cxx index af078dc26b9f..73fa91857f20 100644 --- a/framework/source/helper/oframes.cxx +++ b/framework/source/helper/oframes.cxx @@ -51,7 +51,7 @@ OFrames::OFrames( const css::uno::Reference< XFrame >& xOwner { // Safe impossible cases // Method is not defined for ALL incoming parameters! - LOG_ASSERT( impldbg_checkParameter_OFramesCtor( xOwner, pFrameContainer ), "OFrames::OFrames()\nInvalid parameter detected!\n" ) + SAL_WARN_IF( !impldbg_checkParameter_OFramesCtor( xOwner, pFrameContainer ), "fwk", "OFrames::OFrames(): Invalid parameter detected!" ); } //***************************************************************************************************************** @@ -73,7 +73,7 @@ void SAL_CALL OFrames::append( const css::uno::Reference< XFrame >& xFrame ) thr // Safe impossible cases // Method is not defined for ALL incoming parameters! - LOG_ASSERT( impldbg_checkParameter_append( xFrame ), "OFrames::append()\nInvalid parameter detected!\n" ) + SAL_WARN_IF( !impldbg_checkParameter_append( xFrame ), "fwk", "OFrames::append(): Invalid parameter detected!" ); // Do the follow only, if owner instance valid! // Lock owner for follow operations - make a "hard reference"! @@ -86,7 +86,7 @@ void SAL_CALL OFrames::append( const css::uno::Reference< XFrame >& xFrame ) thr xFrame->setCreator( xOwner ); } // Else; Do nothing! Ouer owner is dead. - LOG_ASSERT( !(xOwner.is()==sal_False), "OFrames::append()\nOuer owner is dead - you can't append any frames ...!\n" ) + SAL_WARN_IF( !xOwner.is(), "fwk", "OFrames::append():Our owner is dead - you can't append any frames ...!" ); } //***************************************************************************************************************** @@ -99,7 +99,7 @@ void SAL_CALL OFrames::remove( const css::uno::Reference< XFrame >& xFrame ) thr // Safe impossible cases // Method is not defined for ALL incoming parameters! - LOG_ASSERT( impldbg_checkParameter_remove( xFrame ), "OFrames::remove()\nInvalid parameter detected!\n" ) + SAL_WARN_IF( !impldbg_checkParameter_remove( xFrame ), "fwk", "OFrames::remove(): Invalid parameter detected!" ); // Do the follow only, if owner instance valid! // Lock owner for follow operations - make a "hard reference"! @@ -113,7 +113,7 @@ void SAL_CALL OFrames::remove( const css::uno::Reference< XFrame >& xFrame ) thr // See documentation of interface XFrames for further information. } // Else; Do nothing! Ouer owner is dead. - LOG_ASSERT( !(xOwner.is()==sal_False), "OFrames::remove()\nOuer owner is dead - you can't remove any frames ...!\n" ) + SAL_WARN_IF( !xOwner.is(), "fwk", "OFrames::remove(): Our owner is dead - you can't remove any frames ...!" ); } //***************************************************************************************************************** @@ -126,7 +126,7 @@ Sequence< css::uno::Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int // Safe impossible cases // Method is not defined for ALL incoming parameters! - LOG_ASSERT( impldbg_checkParameter_queryFrames( nSearchFlags ), "OFrames::queryFrames()\nInvalid parameter detected!\n" ) + SAL_WARN_IF( !impldbg_checkParameter_queryFrames( nSearchFlags ), "fwk", "OFrames::queryFrames(): Invalid parameter detected!" ); // Set default return value. (empty sequence) Sequence< css::uno::Reference< XFrame > > seqFrames; @@ -147,10 +147,7 @@ Sequence< css::uno::Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int //_____________________________________________________________________________________________________________ // Search with AUTO-flag is not supported yet! // We think about right implementation. - LOG_ASSERT( !(nSearchFlags & FrameSearchFlag::AUTO), "OFrames::queryFrames()\nSearch with AUTO-flag is not supported yet!\nWe think about right implementation.\n" ) - // If searched for tasks ... - // Its not supported yet. - LOG_ASSERT( !(nSearchFlags & FrameSearchFlag::AUTO), "OFrames::queryFrames()\nSearch for tasks not supported yet!\n" ) + SAL_WARN_IF( (nSearchFlags & FrameSearchFlag::AUTO), "fwk", "OFrames::queryFrames(): Search with AUTO-flag is not supported yet!" ); //_____________________________________________________________________________________________________________ // Search for ALL and GLOBAL is superflous! @@ -220,7 +217,7 @@ Sequence< css::uno::Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int } } // Else; Do nothing! Ouer owner is dead. - LOG_ASSERT( !(xOwner.is()==sal_False), "OFrames::queryFrames()\nOuer owner is dead - you can't query for frames ...!\n" ) + SAL_WARN_IF( !xOwner.is(), "fwk", "OFrames::queryFrames(): Our owner is dead - you can't query for frames ...!" ); // Resturn result of this operation. return seqFrames; @@ -387,8 +384,6 @@ void OFrames::impl_appendSequence( Sequence< css::uno::Reference< XFram But ... look for right testing! See using of this methods! -----------------------------------------------------------------------------------------------------------------*/ -#ifdef ENABLE_ASSERTIONS - //***************************************************************************************************************** // An instance of this class can only work with valid initialization. // We share the mutex with ouer owner class, need a valid factory to instanciate new services and @@ -475,8 +470,6 @@ sal_Bool OFrames::impldbg_checkParameter_queryFrames( sal_Int32 nSearchFlags ) return bOK ; } -#endif // #ifdef ENABLE_ASSERTIONS - } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 0463b9daba65..3d3c2dcaa2fa 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -1086,7 +1086,7 @@ void AutoRecovery::implts_readConfig() if (aInfo.ID > m_nIdPool) { m_nIdPool = aInfo.ID+1; - LOG_ASSERT(m_nIdPool>=0, "AutoRecovery::implts_readConfig()\nOverflow of IDPool detected!") + SAL_WARN_IF(m_nIdPool<0, "fwk", "AutoRecovery::implts_readConfig(): Overflow of IDPool detected!"); } aWriteLock.unlock(); // <- SAFE ---------------------- @@ -1757,7 +1757,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // create a new cache entry ... this document isn't known. ++m_nIdPool; aNew.ID = m_nIdPool; - LOG_ASSERT(m_nIdPool>=0, "AutoRecovery::implts_registerDocument()\nOverflow of ID pool detected.") + SAL_WARN_IF(m_nIdPool<0, "fwk", "AutoRecovery::implts_registerDocument(): Overflow of ID pool detected."); m_lDocCache.push_back(aNew); AutoRecovery::TDocumentList::iterator pIt1 = AutoRecovery::impl_searchDocument(m_lDocCache, xDocument); diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index e037f2189592..8ea6f783c28e 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -127,8 +127,8 @@ DEFINE_INIT_SERVICE ( Desktop, // Safe impossible cases // We can't work without this helper! - LOG_ASSERT2( m_xFramesHelper.is ()==sal_False, "Desktop::Desktop()", "Frames helper is not valid. XFrames, XIndexAccess and XElementAcces are not supported!\n") - LOG_ASSERT2( m_xDispatchHelper.is()==sal_False, "Desktop::Desktop()", "Dispatch helper is not valid. XDispatch will not work correctly!\n" ) + SAL_WARN_IF( !m_xFramesHelper.is(), "fwk", "Desktop::Desktop(): Frames helper is not valid. XFrames, XIndexAccess and XElementAcces are not supported!"); + SAL_WARN_IF( !m_xDispatchHelper.is(), "fwk", "Desktop::Desktop(): Dispatch helper is not valid. XDispatch will not work correctly!" ); // Enable object for real working! // Otherwise all calls will be rejected ... @@ -167,9 +167,7 @@ Desktop::Desktop( const css::uno::Reference< css::uno::XComponentContext >& xCon , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType > ( m_aLock.getShareableOslMutex() ) , ::cppu::OPropertySetHelper ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) ) // Init member - #ifdef ENABLE_ASSERTIONS , m_bIsTerminated ( sal_False ) // see dispose() for further information! - #endif , m_xContext ( xContext ) , m_aChildTaskContainer ( ) , m_aListenerContainer ( m_aLock.getShareableOslMutex() ) @@ -191,7 +189,7 @@ Desktop::Desktop( const css::uno::Reference< css::uno::XComponentContext >& xCon { // Safe impossible cases // We don't accept all incoming parameter. - LOG_ASSERT2( implcp_ctor( xContext ), "Desktop::Desktop()", "Invalid parameter detected!") + SAL_WARN_IF( implcp_ctor( xContext ), "fwk", "Desktop::Desktop(): Invalid parameter detected!" ); } /*-************************************************************************************************************//** @@ -207,15 +205,8 @@ Desktop::Desktop( const css::uno::Reference< css::uno::XComponentContext >& xCon *//*-*************************************************************************************************************/ Desktop::~Desktop() { -#ifdef ENABLE_ASSERTIONS - // Perhaps we should here do use a real assertion, but make the - // condition more specific? We don't want it to fire in unit tests - // in sc/qa/unit for instance, that don't even have any GUI. - if( !m_bIsTerminated ) - fprintf( stderr, "This used to be an assertion failure: Desktop not terminated before being destructed,\n" - "but it is probably not a real problem.\n" ); -#endif - LOG_ASSERT2( m_aTransactionManager.getWorkingMode()!=E_CLOSE , "Desktop::~Desktop()", "Who forgot to dispose this service?" ) + SAL_WARN_IF( !m_bIsTerminated, "fwk", "Desktop not terminated before being destructed" ); + SAL_WARN_IF( m_aTransactionManager.getWorkingMode()!=E_CLOSE, "fwk", "Desktop::~Desktop(): Who forgot to dispose this service?" ); } css::uno::Any SAL_CALL Desktop::queryInterface( const css::uno::Type& _rType ) throw(css::uno::RuntimeException) @@ -332,7 +323,6 @@ sal_Bool SAL_CALL Desktop::terminate() impl_sendCancelTerminationEvent(lCalledTerminationListener); else { - #ifdef ENABLE_ASSERTIONS // "Protect" us against dispose before terminate calls! // see dispose() for further information. /* SAFE AREA --------------------------------------------------------------------------------------- */ @@ -340,7 +330,6 @@ sal_Bool SAL_CALL Desktop::terminate() m_bIsTerminated = sal_True; aWriteLock.unlock(); /* UNSAFE AREA ------------------------------------------------------------------------------------- */ - #endif impl_sendNotifyTerminationEvent(); @@ -1141,11 +1130,7 @@ void SAL_CALL Desktop::dispose() // But if you just ignore the assertion (which happens in unit // tests for instance in sc/qa/unit) nothing bad happens. -#ifdef ENABLE_ASSERTIONS - if( !m_bIsTerminated ) - fprintf( stderr, "This used to be an assertion failure: Desktop disposed before terminating it,\n" - "but nothing bad seems to happen anyway?\n" ); -#endif + SAL_WARN_IF( !m_bIsTerminated, "fwk", "Desktop disposed before terminating it" ); WriteGuard aWriteLock( m_aLock ); // start synchronize @@ -1229,7 +1214,7 @@ void SAL_CALL Desktop::addEventListener( const css::uno::Reference< css::lang::X /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Safe impossible cases // Method not defined for all incoming parameter. - LOG_ASSERT2( implcp_addEventListener( xListener ), "Desktop::addEventListener()", "Invalid parameter detected!" ) + SAL_WARN_IF( implcp_addEventListener( xListener ), "fwk", "Desktop::addEventListener(): Invalid parameter detected!" ); // Register transaction and reject wrong calls. TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); @@ -1242,7 +1227,7 @@ void SAL_CALL Desktop::removeEventListener( const css::uno::Reference< css::lang /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Safe impossible cases // Method not defined for all incoming parameter. - LOG_ASSERT2( implcp_removeEventListener( xListener ), "Desktop::removeEventListener()", "Invalid parameter detected!" ) + SAL_WARN_IF( implcp_removeEventListener( xListener ), "fwk", "Desktop::removeEventListener(): Invalid parameter detected!" ); // Register transaction and reject wrong calls. TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); @@ -1303,7 +1288,7 @@ void SAL_CALL Desktop::dispatchFinished( const css::frame::DispatchResultEvent& *//*-*************************************************************************************************************/ void SAL_CALL Desktop::disposing( const css::lang::EventObject& ) throw( css::uno::RuntimeException ) { - LOG_ERROR( "Desktop::disposing()", "Algorithm error! Normaly desktop is temp. listener ... not all the time. So this method shouldn't be called." ) + SAL_WARN( "fwk", "Desktop::disposing(): Algorithm error! Normaly desktop is temp. listener ... not all the time. So this method shouldn't be called." ); } /*-************************************************************************************************************//** @@ -1946,17 +1931,6 @@ void Desktop::impl_sendNotifyTerminationEvent() return (nNonClosedFrames < 1); } -//_________________________________________________________________________________________________________________ -// debug methods -//_________________________________________________________________________________________________________________ - -/*----------------------------------------------------------------------------------------------------------------- - The follow methods checks the parameter for other functions. If a parameter or his value is non valid, - we return "sal_True". (otherwise sal_False) This mechanism is used to throw an ASSERT! ------------------------------------------------------------------------------------------------------------------*/ - -#ifdef ENABLE_ASSERTIONS - //***************************************************************************************************************** // We work with valid servicemanager only. sal_Bool Desktop::implcp_ctor( const css::uno::Reference< css::uno::XComponentContext >& xContext ) @@ -1987,8 +1961,6 @@ sal_Bool Desktop::implcp_removeEventListener( const css::uno::Reference< css::la ); } -#endif // #ifdef ENABLE_ASSERTIONS - } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 356172051087..9cfde04f13bb 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -83,10 +83,6 @@ #include #include -#ifdef ENABLE_ASSERTIONS - #include -#endif - #include namespace framework{ @@ -196,10 +192,10 @@ DEFINE_INIT_SERVICE ( Frame, // Safe impossible cases // We can't work without these helpers! - LOG_ASSERT2( xDispatchProvider.is ()==sal_False, "Frame::impl_initService()", "Slowest slave for dispatch- and interception helper isn't valid. XDispatchProvider, XDispatch, XDispatchProviderInterception are not full supported!" ) - LOG_ASSERT2( m_xDispatchHelper.is ()==sal_False, "Frame::impl_initService()", "Interception helper isn't valid. XDispatchProvider, XDispatch, XDispatchProviderInterception are not full supported!" ) - LOG_ASSERT2( m_xFramesHelper.is ()==sal_False, "Frame::impl_initService()", "Frames helper isn't valid. XFrames, XIndexAccess and XElementAcces are not supported!" ) - LOG_ASSERT2( m_xDropTargetListener.is()==sal_False, "Frame::impl_initService()", "DropTarget helper isn't valid. Drag and drop without functionality!" ) + SAL_WARN_IF( !xDispatchProvider.is(), "fwk", "Frame::impl_initService(): Slowest slave for dispatch- and interception helper isn't valid. XDispatchProvider, XDispatch, XDispatchProviderInterception are not full supported!" ); + SAL_WARN_IF( !m_xDispatchHelper.is(), "fwk", "Frame::impl_initService(): Interception helper isn't valid. XDispatchProvider, XDispatch, XDispatchProviderInterception are not full supported!" ); + SAL_WARN_IF( !m_xFramesHelper.is(), "fwk", "Frame::impl_initService(): Frames helper isn't valid. XFrames, XIndexAccess and XElementAcces are not supported!" ); + SAL_WARN_IF( !m_xDropTargetListener.is(), "fwk", "Frame::impl_initService(): DropTarget helper isn't valid. Drag and drop without functionality!" ); //------------------------------------------------------------------------------------------------------------- // establish notifies for changing of "disabled commands" configuration during runtime @@ -263,7 +259,7 @@ Frame::Frame( const css::uno::Reference< css::uno::XComponentContext >& xContext , m_aChildFrameContainer ( ) { // Check incoming parameter to avoid against wrong initialization. - LOG_ASSERT2( implcp_ctor( xContext ), "Frame::Frame()", "Invalid parameter detected!" ) + SAL_WARN_IF( implcp_ctor( xContext ), "fwk", "Frame::Frame(): Invalid parameter detected!" ); /* Please have a look on "@attentions" of description before! */ } @@ -281,7 +277,7 @@ Frame::Frame( const css::uno::Reference< css::uno::XComponentContext >& xContext *//*-*****************************************************************************************************/ Frame::~Frame() { - LOG_ASSERT2( m_aTransactionManager.getWorkingMode()!=E_CLOSE, "Frame::~Frame()", "Who forgot to dispose this service?" ) + SAL_WARN_IF( m_aTransactionManager.getWorkingMode()!=E_CLOSE, "fwk", "Frame::~Frame(): Who forgot to dispose this service?" ); } /*-************************************************************************************************************//** @@ -409,7 +405,7 @@ void SAL_CALL Frame::setActiveFrame( const css::uno::Reference< css::frame::XFra { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Check incoming parameters. - LOG_ASSERT2( implcp_setActiveFrame( xFrame ), "Frame::setActiveFrame()", "Invalid parameter detected!" ) + SAL_WARN_IF( implcp_setActiveFrame( xFrame ), "fwk", "Frame::setActiveFrame(): Invalid parameter detected!" ); // Look for rejected calls! TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); @@ -543,7 +539,7 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& // This must be the first call of this method! // We should initialize our object and open it for working. // Set the new window. - LOG_ASSERT2( m_xContainerWindow.is()==sal_True, "Frame::initialize()", "Leak detected! This state should never occure ..." ) + SAL_WARN_IF( m_xContainerWindow.is(), "fwk", "Frame::initialize(): Leak detected! This state should never occur ..." ); m_xContainerWindow = xWindow; // if window is initially visible, we will never get a windowShowing event @@ -1515,7 +1511,7 @@ void SAL_CALL Frame::addFrameActionListener( const css::uno::Reference< css::fra { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Check incoming parameter. - LOG_ASSERT2( implcp_addFrameActionListener( xListener ), "Frame::addFrameActionListener()", "Invalid parameter detected." ) + SAL_WARN_IF( implcp_addFrameActionListener( xListener ), "fwk", "Frame::addFrameActionListener(): Invalid parameter detected." ); // Listener container is threadsafe by himself ... but we must look for rejected calls! // Our OMenuDispatch-helper (is a member of ODispatchProvider!) is create at startup of this frame BEFORE initialize! // => soft exceptions! @@ -1530,7 +1526,7 @@ void SAL_CALL Frame::removeFrameActionListener( const css::uno::Reference< css:: { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Check incoming parameter. - LOG_ASSERT2( implcp_removeFrameActionListener( xListener ), "Frame::removeFrameActionListener()", "Invalid parameter detected." ) + SAL_WARN_IF( implcp_removeFrameActionListener( xListener ), "fwk", "Frame::removeFrameActionListener(): Invalid parameter detected." ); // Listener container is threadsafe by himself ... but we must look for rejected calls after disposing! // But we must work with E_SOFTEXCEPTIONS ... because sometimes we are called from our listeners // during dispose! Our work mode is E_BEFORECLOSE then ... and E_HARDEXCEPTIONS whould throw a DisposedException. @@ -1974,7 +1970,7 @@ void SAL_CALL Frame::addEventListener( const css::uno::Reference< css::lang::XEv { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Check incoming parameter. - LOG_ASSERT2( implcp_addEventListener( xListener ), "Frame::addEventListener()", "Invalid parameter detected." ) + SAL_WARN_IF( implcp_addEventListener( xListener ), "fwk", "Frame::addEventListener(): Invalid parameter detected." ); // Look for rejected calls only! // Container is threadsafe. TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); @@ -1988,7 +1984,7 @@ void SAL_CALL Frame::removeEventListener( const css::uno::Reference< css::lang:: { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Check incoming parameter. - LOG_ASSERT2( implcp_removeEventListener( xListener ), "Frame::removeEventListener()", "Invalid parameter detected." ) + SAL_WARN_IF( implcp_removeEventListener( xListener ), "fwk", "Frame::removeEventListener(): Invalid parameter detected." ); // Look for rejected calls only! // Container is threadsafe. // Use E_SOFTEXCEPTIONS to allow removing listeners during dispose call! @@ -2182,7 +2178,7 @@ aEvent { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Check incoming parameter. - LOG_ASSERT2( implcp_windowResized( aEvent ), "Frame::windowResized()", "Invalid parameter detected." ) + SAL_WARN_IF( implcp_windowResized( aEvent ), "fwk", "Frame::windowResized(): Invalid parameter detected." ); // Look for rejected calls. // Part of dispose-mechanism => soft exceptions TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); @@ -2202,7 +2198,7 @@ aEvent { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Check incoming parameter. - LOG_ASSERT2( implcp_focusGained( aEvent ), "Frame::focusGained()", "Invalid parameter detected." ) + SAL_WARN_IF( implcp_focusGained( aEvent ), "fwk", "Frame::focusGained(): Invalid parameter detected." ); // Look for rejected calls. // Part of dispose() mechanism ... => soft exceptions! TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); @@ -2242,7 +2238,7 @@ aEvent { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Check incoming parameter. - LOG_ASSERT2( implcp_windowActivated( aEvent ), "Frame::windowActivated()", "Invalid parameter detected." ) + SAL_WARN_IF( implcp_windowActivated( aEvent ), "fwk", "Frame::windowActivated(): Invalid parameter detected." ); // Look for rejected calls. TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); @@ -2269,7 +2265,7 @@ aEvent { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Check incoming parameter. - LOG_ASSERT2( implcp_windowDeactivated( aEvent ), "Frame::windowDeactivated()", "Invalid parameter detected." ) + SAL_WARN_IF( implcp_windowDeactivated( aEvent ), "fwk", "Frame::windowDeactivated(): Invalid parameter detected." ); // Look for rejected calls. // Sometimes called during dispose() => soft exceptions TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); @@ -2446,7 +2442,7 @@ void SAL_CALL Frame::disposing( const css::lang::EventObject& aEvent ) throw( cs { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ // Check incoming parameter. - LOG_ASSERT2( implcp_disposing( aEvent ), "Frame::disposing()", "Invalid parameter detected." ) + SAL_WARN_IF( implcp_disposing( aEvent ), "fwk", "Frame::disposing(): Invalid parameter detected." ); // Look for rejected calls. // May be we are called during releasing our windows in our in dispose call!? => soft exceptions TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); @@ -2506,7 +2502,7 @@ void SAL_CALL Frame::removeActionLock() throw( css::uno::RuntimeException ) /* SAFE AREA */{ WriteGuard aWriteLock( m_aLock ); - LOG_ASSERT2( m_nExternalLockCount<=0, "Frame::removeActionLock()", "Frame isn't locked! Possible multithreading problem detected." ) + SAL_WARN_IF( m_nExternalLockCount<=0, "fwk", "Frame::removeActionLock(): Frame isn't locked! Possible multithreading problem detected." ); --m_nExternalLockCount; }/* SAFE */ @@ -3164,11 +3160,9 @@ void Frame::impl_checkMenuCloser() /*----------------------------------------------------------------------------------------------------------------- The follow methods checks the parameter for other functions. If a parameter or his value is non valid, - we return "sal_True". (otherwise sal_False) This mechanism is used to throw an ASSERT! + we return "sal_True". (otherwise sal_False) This mechanism is used in SAL_WARN_IF calls. -----------------------------------------------------------------------------------------------------------------*/ -#ifdef ENABLE_ASSERTIONS - //***************************************************************************************************************** // We don't accept null pointer or references! sal_Bool Frame::implcp_ctor( const css::uno::Reference< css::uno::XComponentContext >& xContext ) @@ -3271,8 +3265,6 @@ sal_Bool Frame::implcp_disposing( const css::lang::EventObject& aEvent ) ); } -#endif // #ifdef ENABLE_ASSERTIONS - } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index 00fde43c62ab..e05177b9cd84 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -362,7 +362,7 @@ void PathSettings::impl_mergeOldUserPaths( PathSettings::PathInfo& rPath, if (rPath.bIsSinglePath) { - LOG_ASSERT2(lOld.size()>1, "PathSettings::impl_mergeOldUserPaths()", "Single path has more then one path value inside old configuration (Common.xcu)!") + SAL_WARN_IF(lOld.size()>1, "fwk", "PathSettings::impl_mergeOldUserPaths(): Single path has more then one path value inside old configuration (Common.xcu)!"); if (! rPath.sWritePath.equals(sOld)) rPath.sWritePath = sOld; } @@ -852,7 +852,7 @@ void PathSettings::impl_setPathValue( sal_Int32 nID , if (aChangePath.bIsSinglePath) { - LOG_ASSERT2(lList.size()>1, "PathSettings::impl_setPathValue()", "You try to set more then path value for a defined SINGLE_PATH!") + SAL_WARN_IF(lList.size()>1, "fwk", "PathSettings::impl_setPathValue(): You try to set more then path value for a defined SINGLE_PATH!"); if ( !lList.empty() ) aChangePath.sWritePath = *(lList.begin()); else diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx index b9b390c75792..3050b4b65612 100644 --- a/framework/source/services/substitutepathvars.cxx +++ b/framework/source/services/substitutepathvars.cxx @@ -1162,7 +1162,7 @@ void SubstitutePathVariables::SetPredefinedPathVariables( PredefinedPathVariable aPreDefPathVariables.m_eLanguageType = LANGUAGE_ENGLISH_US; OUString aLocaleStr( utl::ConfigManager::getLocale() ); aPreDefPathVariables.m_eLanguageType = LanguageTag::convertToLanguageTypeWithFallback( aLocaleStr ); - // We used to have an else branch here with a LOG_ERROR, but that + // We used to have an else branch here with a SAL_WARN, but that // always fired in some unit tests when this code was built with // debug=t, so it seems fairly pointless, especially as // aPreDefPathVariables.m_eLanguageType has been initialized to a diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx index 39b5d35a110c..6d7bf4e6317c 100644 --- a/framework/source/services/tabwindowservice.cxx +++ b/framework/source/services/tabwindowservice.cxx @@ -96,7 +96,7 @@ TabWindowService::TabWindowService( const css::uno::Reference< css::lang::XMulti { // Safe impossible cases. // Method not defined for all incoming parameter. - LOG_ASSERT( xFactory.is(), "TabWindowService::TabWindowService()\nInvalid parameter detected!\n" ) + SAL_WARN_IF( !xFactory.is(), "fwk", "TabWindowService::TabWindowService(): Invalid parameter detected!" ); } //***************************************************************************************************************** diff --git a/framework/source/services/urltransformer.cxx b/framework/source/services/urltransformer.cxx index 13cdf557ee97..be492c5ceb2e 100644 --- a/framework/source/services/urltransformer.cxx +++ b/framework/source/services/urltransformer.cxx @@ -41,7 +41,7 @@ URLTransformer::URLTransformer( const Reference< XMultiServiceFactory >& /*xFact { // Safe impossible cases. // Method not defined for all incoming parameter. - //LOG_ASSERT( xFactory.is(), "URLTransformer::URLTransformer()\nInvalid parameter detected!\n" ) + //SAL_WARN_IF( !xFactory.is(), "fwk", "URLTransformer::URLTransformer(): Invalid parameter detected!" ); } //***************************************************************************************************************** -- cgit