sw/source/core/unocore/unoparagraph.cxx | 4 +++- sw/source/core/unocore/unotext.cxx | 5 ++--- sw/source/uibase/uno/unotxvw.cxx | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-)
New commits: commit be5582f8ed5fe799695e6a483f7c2b7728109fa2 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Mon Dec 3 12:19:27 2018 +0300 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Wed Dec 5 16:55:33 2018 +0100 sw uno: do not throw exceptions on getString() getString() is passive method and no reason to throw an exception instead of returning empty string in some corner situations like object is being disposed. As a compromise information about inbalid state is reported into log. Change-Id: Ied6ecb356ce341d44e5a2bb21fb8379257e38c31 Reviewed-on: https://gerrit.libreoffice.org/64442 Reviewed-by: Michael Stahl <michael.st...@cib.de> Tested-by: Jenkins (cherry picked from commit dae741a2418f1d1dd35d364ec416516cc50f5054) Reviewed-on: https://gerrit.libreoffice.org/64627 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 39417de5c410..47919339ecf0 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -1383,7 +1383,9 @@ OUString SAL_CALL SwXParagraph::getString() throw (uno::RuntimeException, std::e } else { - throw uno::RuntimeException(); + // Seems object is being disposed or some other problem occurs. + // Anyway from user point of view object still exist, so on that level this is not an error + SAL_WARN("sw.uno", "getString() for invalid paragraph called. Returning empty string."); } return aRet; } diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 3255daa35c21..94982e1fc058 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -900,9 +900,8 @@ OUString SAL_CALL SwXText::getString() throw (uno::RuntimeException, std::except const uno::Reference< text::XTextCursor > xRet = CreateCursor(); if(!xRet.is()) { - uno::RuntimeException aRuntime; - aRuntime.Message = cInvalidObject; - throw aRuntime; + SAL_WARN("sw.uno", "cursor was not created in getString() call. Returning empty string."); + return OUString(); } xRet->gotoEnd(true); return xRet->getString(); diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index ecbb9df8a620..29f4fa5e89d6 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -1413,7 +1413,10 @@ OUString SwXTextViewCursor::getString() if(m_pView) { if (!IsTextSelection( false )) - throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) ); + { + SAL_WARN("sw.uno", "no text selection in getString() " << static_cast<cppu::OWeakObject*>(this)); + return uRet; + } ShellModes eSelMode = m_pView->GetShellMode(); switch(eSelMode) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits