summaryrefslogtreecommitdiff
path: root/pyuno/source
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2006-03-22 09:48:37 +0000
committerOliver Bolte <obo@openoffice.org>2006-03-22 09:48:37 +0000
commita48afb6fbf5d8cf10c6a1fc70d99a88de987bdde (patch)
treef53acd5f4b7702e4946d7c763112375e4fe455a6 /pyuno/source
parenta69acc3c83bf2dcbc5dd6467060456b328d4097b (diff)
INTEGRATION: CWS pyunofixes2 (1.6.12); FILE MERGED
2006/01/07 21:36:51 jbu 1.6.12.3: RESYNC: (1.6-1.7); FILE MERGED 2005/09/09 18:51:58 jbu 1.6.12.2: #i54416# removed now obsolete PYUNO_DEBUG macro 2005/09/09 18:43:07 jbu 1.6.12.1: #i54416#,#i47270# added logging support for pyuno + refcounting bug for __members__ variable fixed
Diffstat (limited to 'pyuno/source')
-rw-r--r--pyuno/source/module/pyuno_adapter.cxx66
1 files changed, 61 insertions, 5 deletions
diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx
index 19f3839134bc..6139547b2d27 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: pyuno_adapter.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: rt $ $Date: 2005-09-08 16:51:33 $
+ * last change: $Author: obo $ $Date: 2006-03-22 10:48:37 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -214,11 +214,20 @@ Any Adapter::invoke( const OUString &aFunctionName,
}
+ RuntimeCargo *cargo = 0;
+ try
+ {
PyThreadAttach guard( mInterpreter );
{
// convert parameters to python args
// TODO: Out parameter
Runtime runtime;
+ cargo = runtime.getImpl()->cargo;
+ if( isLog( cargo, LogLevel::CALL ) )
+ {
+ logCall( cargo, "try uno->py[0x",
+ (sal_Int64) mWrappedObject.get(), aFunctionName, aParams );
+ }
sal_Int32 size = aParams.getLength();
PyRef argsTuple(PyTuple_New( size ), SAL_NO_ACQUIRE );
@@ -251,9 +260,7 @@ Any Adapter::invoke( const OUString &aFunctionName,
throw IllegalArgumentException( buf.makeStringAndClear(), Reference< XInterface > (),0 );
}
- PYUNO_DEBUG_2( "entering python method %s\n" , (char*)TO_ASCII(aFunctionName) );
PyRef pyRet( PyObject_CallObject( method.get(), argsTuple.get() ), SAL_NO_ACQUIRE );
- PYUNO_DEBUG_3( "leaving python method %s %d\n" , (char*)TO_ASCII(aFunctionName) , pyRet.is() );
raiseInvocationTargetExceptionWhenNeeded( runtime);
if( pyRet.is() )
{
@@ -307,8 +314,57 @@ Any Adapter::invoke( const OUString &aFunctionName,
// else { sequence is a return value !}
}
}
+
+ // log the reply, if desired
+ if( isLog( cargo, LogLevel::CALL ) )
+ {
+ logReply( cargo, "success uno->py[0x" ,
+ (sal_Int64) mWrappedObject.get(), aFunctionName, ret, aOutParam );
+ }
+ }
+
+ }
+ catch(InvocationTargetException & e )
+ {
+ if( isLog( cargo, LogLevel::CALL ) )
+ {
+ logException(
+ cargo, "except uno->py[0x" ,
+ (sal_Int64) mWrappedObject.get(), aFunctionName,
+ e.TargetException.getValue(),e.TargetException.getValueType() );
+ }
+ throw;
+ }
+ catch( RuntimeException & e )
+ {
+ if( cargo && isLog( cargo, LogLevel::CALL ) )
+ {
+ logException(
+ cargo, "except uno->py[0x" ,
+ (sal_Int64) mWrappedObject.get(), aFunctionName, &e,getCppuType(&e) );
+ }
+ throw;
+ }
+ catch( CannotConvertException & e )
+ {
+ if( isLog( cargo, LogLevel::CALL ) )
+ {
+ logException(
+ cargo, "except uno->py[0x" ,
+ (sal_Int64) mWrappedObject.get(), aFunctionName, &e,getCppuType(&e) );
+ }
+ throw;
+ }
+ catch( IllegalArgumentException & e )
+ {
+ if( isLog( cargo, LogLevel::CALL ) )
+ {
+ logException(
+ cargo, "except uno->py[0x" ,
+ (sal_Int64) mWrappedObject.get(), aFunctionName, &e,getCppuType(&e) );
+ }
+ throw;
}
- PYUNO_DEBUG_1( "leaving Adapter::invoke normally\n" );
return ret;
}