Kaydet (Commit) a9fc9f4a authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Drop unused E_NOEXCEPTIONS

Change-Id: I558684352cc99002752d4c5d118a0c46572bd6f0
üst b6df953c
...@@ -54,7 +54,7 @@ class TransactionGuard : private boost::noncopyable ...@@ -54,7 +54,7 @@ class TransactionGuard : private boost::noncopyable
from different threads at the same time ... this class use no refcount mechanism! from different threads at the same time ... this class use no refcount mechanism!
@param "rManager" reference to transaction manager for using to register a request @param "rManager" reference to transaction manager for using to register a request
@param "eMode" enable/disable throwing of exceptions for rejected calls @param "eMode" enable/disable throwing of exceptions for rejected calls
@param "eReason" returns reason for rejected calls if "eMode=E_NOEXCEPTIONS"! @param "eReason" returns reason for rejected calls
*//*-*****************************************************************************************************/ *//*-*****************************************************************************************************/
inline TransactionGuard( TransactionManager& rManager, EExceptionMode eMode, ERejectReason* eReason = NULL ) inline TransactionGuard( TransactionManager& rManager, EExceptionMode eMode, ERejectReason* eReason = NULL )
: m_pManager( &rManager ) : m_pManager( &rManager )
......
...@@ -68,7 +68,6 @@ enum ERejectReason ...@@ -68,7 +68,6 @@ enum ERejectReason
e.g. We can throw a DisposedException if user try to work and our mode is E_CLOSE! e.g. We can throw a DisposedException if user try to work and our mode is E_CLOSE!
But sometimes he dont need this feature - will handle it by himself. But sometimes he dont need this feature - will handle it by himself.
Then we must differ between some exception-modi: Then we must differ between some exception-modi:
E_NOEXCEPTIONS We never throw any exceptions! User handle it private and looks for ERejectReason.
E_HARDEXCEPTIONS We throw exceptions for all working modes different from E_WORK! E_HARDEXCEPTIONS We throw exceptions for all working modes different from E_WORK!
E_SOFTEXCEPTIONS We throw exceptions for all working modes different from E_WORK AND E_INCLOSE! E_SOFTEXCEPTIONS We throw exceptions for all working modes different from E_WORK AND E_INCLOSE!
This mode is useful for impl-methods which should be callable from dispose() method! This mode is useful for impl-methods which should be callable from dispose() method!
...@@ -96,7 +95,6 @@ enum ERejectReason ...@@ -96,7 +95,6 @@ enum ERejectReason
*//*-*************************************************************************************************************/ *//*-*************************************************************************************************************/
enum EExceptionMode enum EExceptionMode
{ {
E_NOEXCEPTIONS ,
E_HARDEXCEPTIONS, E_HARDEXCEPTIONS,
E_SOFTEXCEPTIONS E_SOFTEXCEPTIONS
}; };
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <sal/config.h>
#include <cassert>
#include <threadhelp/transactionmanager.hxx> #include <threadhelp/transactionmanager.hxx>
#include <macros/generic.hxx> #include <macros/generic.hxx>
...@@ -57,8 +61,8 @@ TransactionManager::~TransactionManager() ...@@ -57,8 +61,8 @@ TransactionManager::~TransactionManager()
E_BEFORECLOSE : The object start the closing mechanism ... but sometimes E_BEFORECLOSE : The object start the closing mechanism ... but sometimes
e.g. the dispose() method need to call some private methods. e.g. the dispose() method need to call some private methods.
These some special methods should use E_SOFTEXCEPTIONS or ignore These some special methods should use E_SOFTEXCEPTIONS
E_INCLOSE as returned reason for E_NOEXCEPTIONS to detect this special case! to detect this special case!
E_CLOSE : Object is already dead! All further requests will be refused. E_CLOSE : Object is already dead! All further requests will be refused.
It's your decision to react in a right way. It's your decision to react in a right way.
...@@ -150,7 +154,7 @@ EWorkingMode TransactionManager::getWorkingMode() const ...@@ -150,7 +154,7 @@ EWorkingMode TransactionManager::getWorkingMode() const
@seealso method unregisterTransaction() @seealso method unregisterTransaction()
@param "eMode" ,used to enable/disable throwing exceptions automatically for rejected calls @param "eMode" ,used to enable/disable throwing exceptions automatically for rejected calls
@param "eReason" ,reason for rejected calls if eMode=E_NOEXCEPTIONS @param "eReason" ,reason for rejected calls
*//*-*****************************************************************************************************/ *//*-*****************************************************************************************************/
void TransactionManager::registerTransaction( EExceptionMode eMode, ERejectReason& eReason ) throw( css::uno::RuntimeException, css::lang::DisposedException ) void TransactionManager::registerTransaction( EExceptionMode eMode, ERejectReason& eReason ) throw( css::uno::RuntimeException, css::lang::DisposedException )
{ {
...@@ -245,37 +249,35 @@ bool TransactionManager::isCallRejected( ERejectReason& eReason ) const ...@@ -245,37 +249,35 @@ bool TransactionManager::isCallRejected( ERejectReason& eReason ) const
*//*-*****************************************************************************************************/ *//*-*****************************************************************************************************/
void TransactionManager::impl_throwExceptions( EExceptionMode eMode, ERejectReason eReason ) const throw( css::uno::RuntimeException, css::lang::DisposedException ) void TransactionManager::impl_throwExceptions( EExceptionMode eMode, ERejectReason eReason ) const throw( css::uno::RuntimeException, css::lang::DisposedException )
{ {
if( eMode != E_NOEXCEPTIONS ) switch( eReason )
{ {
switch( eReason ) case E_UNINITIALIZED : if( eMode == E_HARDEXCEPTIONS )
{ {
case E_UNINITIALIZED : if( eMode == E_HARDEXCEPTIONS ) // Help programmer to find out, why this exception is thrown!
{ SAL_WARN( "fwk", "TransactionManager...: Owner instance not correctly initialized yet. Call was rejected! Normally it's an algorithm error ... wrong use of class!" );
// Help programmer to find out, why this exception is thrown! //ATTENTION: temp. disabled - till all bad code positions are detected and changed! */
SAL_WARN( "fwk", "TransactionManager...: Owner instance not correctly initialized yet. Call was rejected! Normally it's an algorithm error ... wrong use of class!" ); // throw css::uno::RuntimeException( "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 >() );
//ATTENTION: temp. disabled - till all bad code positions are detected and changed! */ }
// throw css::uno::RuntimeException( "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 >() ); break;
} case E_INCLOSE : if( eMode == E_HARDEXCEPTIONS )
break; {
case E_INCLOSE : if( eMode == E_HARDEXCEPTIONS ) // Help programmer to find out, why this exception is thrown!
{ SAL_WARN( "fwk", "TransactionManager...: Owner instance stand in close method. Call was rejected!" );
// Help programmer to find out, why this exception is thrown! throw css::lang::DisposedException( "TransactionManager...\nOwner 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( "TransactionManager...\nOwner instance stand in close method. Call was rejected!" ); break;
} case E_CLOSED : {
break; // Help programmer to find out, why this exception is thrown!
case E_CLOSED : { SAL_WARN( "fwk", "TransactionManager...: Owner instance already closed. Call was rejected!" );
// Help programmer to find out, why this exception is thrown! throw css::lang::DisposedException( "TransactionManager...\nOwner instance already closed. Call was rejected!" );
SAL_WARN( "fwk", "TransactionManager...: Owner instance already closed. Call was rejected!" ); }
throw css::lang::DisposedException( "TransactionManager...\nOwner instance already closed. Call was rejected!" ); case E_NOREASON : {
} // Help programmer to find out
case E_NOREASON : { SAL_WARN( "fwk", "TransactionManager...: Impossible case E_NOREASON!" );
// Help programmer to find out }
SAL_WARN( "fwk", "TransactionManager...: Impossible case E_NOREASON!" ); break;
} default:
break; assert(false);
default: break; // nothing to do
}
} }
} }
......
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