[Libreoffice-commits] core.git: 2 commits - sw/source testtools/source

Stephan Bergmann sbergman at redhat.com
Wed Feb 15 14:17:23 UTC 2017


 sw/source/ui/vba/vbaselection.cxx          |    6 +-----
 sw/source/uibase/uno/unotxdoc.cxx          |    4 ++--
 testtools/source/bridgetest/bridgetest.cxx |    6 +-----
 testtools/source/performance/ubtest.cxx    |    4 +---
 4 files changed, 5 insertions(+), 15 deletions(-)

New commits:
commit 5ed0dc584160b74eca08f7f8ba1e15ef40d163df
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 14 16:09:54 2017 +0100

    Some simplifications, using UNO_QUERY_THROW
    
    Change-Id: I1a2239b596201bc0172f2a6ade177c10491be9c2
    Reviewed-on: https://gerrit.libreoffice.org/34255
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sw/source/ui/vba/vbaselection.cxx b/sw/source/ui/vba/vbaselection.cxx
index be9eb17..fc5017d 100644
--- a/sw/source/ui/vba/vbaselection.cxx
+++ b/sw/source/ui/vba/vbaselection.cxx
@@ -803,11 +803,7 @@ SwVbaSelection::Tables( const uno::Any& aIndex )
     }
 
     // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
-    uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-
-    if ( !xTextTableCursor.is() )
-       throw uno::RuntimeException();
-
+    uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
     SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() );
     if ( pTTCursor )
     {
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index a6aadb5..cd1e00c 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -737,8 +737,8 @@ SwUnoCursor* SwXTextDocument::CreateCursorForSearch(Reference< XTextCursor > & x
 sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > & xDesc)
 {
     SolarMutexGuard aGuard;
-    Reference< XUnoTunnel > xDescTunnel(xDesc, UNO_QUERY);
-    if(!IsValid() || !xDescTunnel.is() || !xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()))
+    Reference< XUnoTunnel > xDescTunnel(xDesc, UNO_QUERY_THROW);
+    if(!IsValid() || !xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()))
         throw RuntimeException();
 
     Reference< XTextCursor >  xCursor;
commit c68b5c36cdadeedd47dfb68aee10c5df8513dbdc
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 14 16:09:48 2017 +0100

    Some simplifications, using UNO_QUERY_THROW
    
    Change-Id: Iaf7b4695e7930b8e7fa5dd3736d19744afb52fa3
    Reviewed-on: https://gerrit.libreoffice.org/34254
    Tested-by: Stephan Bergmann <sbergman at redhat.com>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx
index bc238c6..fede2db 100644
--- a/testtools/source/bridgetest/bridgetest.cxx
+++ b/testtools/source/bridgetest/bridgetest.cxx
@@ -1155,11 +1155,7 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs )
         {
             throw RuntimeException( "cannot get test object!" );
         }
-        Reference< XBridgeTest > xTest( xOriginal, UNO_QUERY );
-        if (! xTest.is())
-        {
-            throw RuntimeException( "test object does not implement XBridgeTest!" );
-        }
+        Reference< XBridgeTest > xTest( xOriginal, UNO_QUERY_THROW );
 
         Reference<XBridgeTest > xLBT;
         bRet = check( makeSurrogate( xLBT, xTest ), "makeSurrogate" );
diff --git a/testtools/source/performance/ubtest.cxx b/testtools/source/performance/ubtest.cxx
index 5b1ebee..acf0969 100644
--- a/testtools/source/performance/ubtest.cxx
+++ b/testtools/source/performance/ubtest.cxx
@@ -554,9 +554,7 @@ static void benchmark(
     TimingSheet & rSheet, const Reference< XInterface > & xInstance, sal_Int64 nLoop )
     throw (Exception)
 {
-    Reference< XPerformanceTest > xBench( xInstance, UNO_QUERY );
-    if (! xBench.is())
-        throw RuntimeException("illegal test object!" );
+    Reference< XPerformanceTest > xBench( xInstance, UNO_QUERY_THROW );
 
     sal_Int64 i;
     sal_uInt32 tStart, tEnd;


More information about the Libreoffice-commits mailing list