Kaydet (Commit) 48a697ef authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#706394 Uncaught exception

and hopefully a bunch more of those in dbaccess

Change-Id: I5aefcfe56a697f9e6b18dfe167fdd8a4f54ab6e0
üst 535780bd
...@@ -631,18 +631,49 @@ private: ...@@ -631,18 +631,49 @@ private:
class DocumentGuard : private ModelMethodGuard class DocumentGuard : private ModelMethodGuard
{ {
public: public:
enum MethodType enum __InitMethod
{ {
// a method which is to initialize the document // a method which is to initialize the document
InitMethod, InitMethod,
};
enum __DefaultMethod
{
// a default method // a default method
DefaultMethod, DefaultMethod
};
enum __MethodUsedDuringInit
{
// a method which is used (externally) during the initialization phase // a method which is used (externally) during the initialization phase
MethodUsedDuringInit, MethodUsedDuringInit
};
enum __MethodWithoutInit
{
// a method which does not need initialization - use with care! // a method which does not need initialization - use with care!
MethodWithoutInit MethodWithoutInit
}; };
/** constructs the guard
@param _document
the ODatabaseDocument instance
@throws ::com::sun::star::lang::DisposedException
If the given component is already disposed
@throws ::com::sun::star::lang::NotInitializedException
if the given component is not yet initialized
*/
DocumentGuard(const ODatabaseDocument& _document, __DefaultMethod)
: ModelMethodGuard(_document)
, m_document(_document )
{
m_document.checkInitialized();
}
/** constructs the guard /** constructs the guard
@param _document @param _document
...@@ -652,24 +683,46 @@ public: ...@@ -652,24 +683,46 @@ public:
If the given component is already disposed If the given component is already disposed
@throws ::com::sun::star::frame::DoubleInitializationException @throws ::com::sun::star::frame::DoubleInitializationException
if _eType is InitMethod, and the given component is already initialized, or currently being initialized. if the given component is already initialized, or currently being initialized.
*/
DocumentGuard(const ODatabaseDocument& _document, __InitMethod)
: ModelMethodGuard(_document)
, m_document(_document)
{
m_document.checkNotInitialized();
}
/** constructs the guard
@param _document
the ODatabaseDocument instance
@throws ::com::sun::star::lang::DisposedException
If the given component is already disposed
@throws ::com::sun::star::lang::NotInitializedException @throws ::com::sun::star::lang::NotInitializedException
if _eType is DefaultMethod, and the given component is not yet initialized; or if _eType if the component is still uninitialized, and not in the initialization
is MethodUsedDuringInit, and the component is still uninitialized, and not in the initialization
phase currently. phase currently.
*/ */
DocumentGuard( const ODatabaseDocument& _document, MethodType _eType = DefaultMethod ) DocumentGuard(const ODatabaseDocument& _document, __MethodUsedDuringInit)
:ModelMethodGuard( _document ) : ModelMethodGuard(_document)
,m_document( _document ) , m_document(_document)
{
m_document.checkNotUninitilized();
}
/** constructs the guard
@param _document
the ODatabaseDocument instance
@throws ::com::sun::star::lang::DisposedException
If the given component is already disposed
*/
DocumentGuard(const ODatabaseDocument& _document, __MethodWithoutInit)
: ModelMethodGuard( _document )
, m_document( _document )
{ {
switch ( _eType )
{
case InitMethod: m_document.checkNotInitialized(); break;
case DefaultMethod: m_document.checkInitialized(); break;
case MethodUsedDuringInit: m_document.checkNotUninitilized(); break;
case MethodWithoutInit: break;
}
} }
~DocumentGuard() ~DocumentGuard()
......
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