diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-02-14 16:10:31 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-02-15 14:18:17 +0000 |
commit | e3aef4dc7c335b0906d3cd87ecf98b60bb3b7c53 (patch) | |
tree | ee3edd1bb93283454d0822418151baccf5b17c8d /pyuno | |
parent | 57c4fe05d7f3c7593198c0f82e29943d5791a470 (diff) |
Some simplifications, using UNO_QUERY_THROW
Change-Id: Ib973a403a830a3ecf8e57a5e70a581ba06f96a05
Reviewed-on: https://gerrit.libreoffice.org/34264
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/source/module/pyuno.cxx | 4 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_runtime.cxx | 15 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_struct.cxx | 5 |
3 files changed, 5 insertions, 19 deletions
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index e94309def148..473df58e1972 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 b14cbde39a57..755a6dc46a75 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 437b4a8f1614..be8e0b913807 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(); |