diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-05-24 15:07:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-05-24 16:10:59 +0100 |
commit | 31ded1744150cac86c270957fd0fa193e8437a36 (patch) | |
tree | a63557e1cd8aca1bc9432979580fccf3af39c3de | |
parent | 8bafbd2c40a156b95552d1594396e16a3053bbaa (diff) |
coverity#983807 Uncaught exception
Change-Id: Ic303dae356690db009b5917168b77da2f2d8d433
-rw-r--r-- | sdext/source/presenter/PresenterAccessibility.cxx | 50 |
1 files changed, 14 insertions, 36 deletions
diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx index 3b82fd3a7d00..a4c66f0ea729 100644 --- a/sdext/source/presenter/PresenterAccessibility.cxx +++ b/sdext/source/presenter/PresenterAccessibility.cxx @@ -226,13 +226,10 @@ protected: void UpdateState (const sal_Int16 aState, const bool bValue); - bool IsDisposed (void) const; + bool IsDisposed() const; - void ThrowIfDisposed (void) const + void ThrowIfDisposed() const throw (css::lang::DisposedException); - - enum ExceptionType { ET_Runtime, ET_Disposed, ET_IndexOutOfBounds }; - void ThrowException (const sal_Char* pMessage, const ExceptionType eExceptionType) const; }; //===== AccessibleStateSet ==================================================== @@ -899,7 +896,7 @@ Reference<XAccessible> SAL_CALL ThrowIfDisposed(); if (nIndex<0 || nIndex>=sal_Int32(maChildren.size())) - ThrowException("invalid child index", ET_IndexOutOfBounds); + throw lang::IndexOutOfBoundsException("invalid child index", uno::Reference<uno::XInterface>(static_cast<uno::XWeak*>(this))); return Reference<XAccessible>(maChildren[nIndex].get()); } @@ -1300,13 +1297,13 @@ void PresenterAccessible::AccessibleObject::FireAccessibleEvent ( { (*iListener)->notifyEvent(aEventObject); } - catch(lang::DisposedException&) + catch (const lang::DisposedException&) { // Listener has been disposed and should have been removed // already. removeAccessibleEventListener(*iListener); } - catch(Exception&) + catch (const Exception&) { // Ignore all other exceptions and assume that they are // caused by a temporary problem. @@ -1314,7 +1311,7 @@ void PresenterAccessible::AccessibleObject::FireAccessibleEvent ( } } -awt::Point PresenterAccessible::AccessibleObject::GetRelativeLocation (void) +awt::Point PresenterAccessible::AccessibleObject::GetRelativeLocation() { awt::Point aLocation; if (mxContentWindow.is()) @@ -1332,7 +1329,7 @@ awt::Point PresenterAccessible::AccessibleObject::GetRelativeLocation (void) return aLocation; } -awt::Size PresenterAccessible::AccessibleObject::GetSize (void) +awt::Size PresenterAccessible::AccessibleObject::GetSize() { if (mxContentWindow.is()) { @@ -1343,7 +1340,7 @@ awt::Size PresenterAccessible::AccessibleObject::GetSize (void) return awt::Size(); } -awt::Point PresenterAccessible::AccessibleObject::GetAbsoluteParentLocation (void) +awt::Point PresenterAccessible::AccessibleObject::GetAbsoluteParentLocation() { Reference<XAccessibleComponent> xParentComponent; if (mxParentAccessible.is()) @@ -1355,35 +1352,16 @@ awt::Point PresenterAccessible::AccessibleObject::GetAbsoluteParentLocation (voi return awt::Point(); } -bool PresenterAccessible::AccessibleObject::IsDisposed (void) const +bool PresenterAccessible::AccessibleObject::IsDisposed() const { return (rBHelper.bDisposed || rBHelper.bInDispose); } -void PresenterAccessible::AccessibleObject::ThrowIfDisposed (void) const +void PresenterAccessible::AccessibleObject::ThrowIfDisposed() const throw (lang::DisposedException) { if (rBHelper.bDisposed || rBHelper.bInDispose) - ThrowException("object has already been disposed", ET_Disposed); -} - -void PresenterAccessible::AccessibleObject::ThrowException ( - const sal_Char* pMessage, - const ExceptionType eExceptionType) const -{ - const OUString sMessage ("PresenterAccessible: " + OUString::createFromAscii(pMessage)); - const Reference<XInterface> xObject ( - const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this))); - switch (eExceptionType) - { - default: - case ET_Runtime: - throw RuntimeException(sMessage, xObject); - case ET_Disposed: - throw lang::DisposedException(sMessage, xObject); - case ET_IndexOutOfBounds: - throw lang::IndexOutOfBoundsException(sMessage, xObject); - } + throw lang::DisposedException("object has already been disposed", uno::Reference<uno::XInterface>((uno::XWeak*)(this))); } //===== AccessibleStateSet ==================================================== @@ -1591,7 +1569,7 @@ sal_Unicode SAL_CALL PresenterAccessible::AccessibleParagraph::getCharacter (sal ThrowIfDisposed(); if (!mpParagraph) - ThrowException("no text support in current mode", ET_IndexOutOfBounds); + throw lang::IndexOutOfBoundsException("no text support in current mode", uno::Reference<uno::XInterface>(static_cast<uno::XWeak*>(this))); return mpParagraph->GetCharacter(nIndex); } @@ -1631,7 +1609,7 @@ awt::Rectangle SAL_CALL PresenterAccessible::AccessibleParagraph::getCharacterBo awt::Rectangle aCharacterBox; if (nIndex < 0) { - ThrowException("invalid text index", ET_IndexOutOfBounds); + throw lang::IndexOutOfBoundsException("invalid text index", uno::Reference<uno::XInterface>(static_cast<uno::XWeak*>(this))); } else if (mpParagraph) { @@ -1644,7 +1622,7 @@ awt::Rectangle SAL_CALL PresenterAccessible::AccessibleParagraph::getCharacterBo } else { - ThrowException("no text support in current mode", ET_IndexOutOfBounds); + throw lang::IndexOutOfBoundsException("no text support in current mode", uno::Reference<uno::XInterface>(static_cast<uno::XWeak*>(this))); } return aCharacterBox; |