[Libreoffice-commits] core.git: 2 commits - pyuno/source remotebridges/source

Stephan Bergmann sbergman at redhat.com
Wed Feb 15 14:18:29 UTC 2017


 pyuno/source/module/pyuno.cxx                            |    4 +---
 pyuno/source/module/pyuno_runtime.cxx                    |   15 +++------------
 pyuno/source/module/pyuno_struct.cxx                     |    5 +----
 remotebridges/source/unourl_resolver/unourl_resolver.cxx |    6 +-----
 4 files changed, 6 insertions(+), 24 deletions(-)

New commits:
commit e3aef4dc7c335b0906d3cd87ecf98b60bb3b7c53
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 14 16:10:31 2017 +0100

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

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index e94309d..473df58 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1709,9 +1709,7 @@ PyRef PyUNO_new (
     {
         PyThreadDetach antiguard;
         xInvocation.set(
-            ssf->createInstanceWithArguments( Sequence<Any>( &targetInterface, 1 ) ), UNO_QUERY );
-        if( !xInvocation.is() )
-            throw RuntimeException("XInvocation2 not implemented, cannot interact with object");
+            ssf->createInstanceWithArguments( Sequence<Any>( &targetInterface, 1 ) ), css::uno::UNO_QUERY_THROW );
 
         Reference<XUnoTunnel> xUnoTunnel (
             xInvocation->getIntrospection()->queryAdapter(cppu::UnoType<XUnoTunnel>::get()), UNO_QUERY );
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index b14cbde..755a6dc 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -267,9 +267,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
         ctx->getServiceManager()->createInstanceWithContext(
             "com.sun.star.script.Invocation",
             ctx ),
-        UNO_QUERY );
-    if( ! c->xInvocation.is() )
-        throw RuntimeException( "pyuno: couldn't instantiate invocation service" );
+        css::uno::UNO_QUERY_THROW );
 
     c->xTypeConverter = Converter::create(ctx);
     if( ! c->xTypeConverter.is() )
@@ -792,15 +790,8 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
         else if( PyObject_IsInstance( o, getPyUnoStructClass().get() ) )
         {
             PyUNO* o_pi = reinterpret_cast<PyUNO*>(o);
-            Reference<XMaterialHolder> my_mh (o_pi->members->xInvocation, UNO_QUERY);
-
-            if (!my_mh.is())
-            {
-                throw RuntimeException(
-                    "struct wrapper does not support XMaterialHolder" );
-            }
-            else
-                a = my_mh->getMaterial();
+            Reference<XMaterialHolder> my_mh (o_pi->members->xInvocation, css::uno::UNO_QUERY_THROW);
+            a = my_mh->getMaterial();
         }
         else if( PyObject_IsInstance( o, getCharClass( runtime ).get() ) )
         {
diff --git a/pyuno/source/module/pyuno_struct.cxx b/pyuno/source/module/pyuno_struct.cxx
index 437b4a8..be8e0b9 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -368,10 +368,7 @@ PyRef PyUNOStruct_new (
     {
         PyThreadDetach antiguard;
         xInvocation.set(
-            ssf->createInstanceWithArguments( Sequence<Any>( &targetInterface, 1 ) ), UNO_QUERY );
-        OSL_ASSERT( xInvocation.is() );
-        if( !xInvocation.is() )
-            throw RuntimeException("XInvocation2 not implemented, cannot interact with object");
+            ssf->createInstanceWithArguments( Sequence<Any>( &targetInterface, 1 ) ), css::uno::UNO_QUERY_THROW );
     }
     if( !Py_IsInitialized() )
         throw RuntimeException();
commit 57c4fe05d7f3c7593198c0f82e29943d5791a470
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 14 16:10:27 2017 +0100

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

diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx
index b7a208f..1e80b1b 100644
--- a/remotebridges/source/unourl_resolver/unourl_resolver.cxx
+++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx
@@ -116,11 +116,7 @@ Reference< XInterface > ResolverImpl::resolve( const OUString & rUnoUrl )
 
     Reference< XConnector > xConnector(
         _xSMgr->createInstanceWithContext( "com.sun.star.connection.Connector", _xCtx ),
-        UNO_QUERY );
-
-    if (! xConnector.is())
-        throw RuntimeException("no connector!" );
-
+        UNO_QUERY_THROW );
     Reference< XConnection > xConnection( xConnector->connect( aConnectDescr ) );
 
     // As soon as singletons are ready, switch to singleton !


More information about the Libreoffice-commits mailing list