From 214c3799581b753c9adaf0d7a660f55b7adb3300 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 3 Dec 2013 15:45:02 +0100 Subject: Clean up use of OSL debug functionality Change-Id: I1efcdb7359ac43ee50d2f526bc29a10b1bef35b4 --- bridges/source/jni_uno/jni_base.h | 6 +- bridges/source/jni_uno/jni_bridge.cxx | 94 ++++++++++------------- bridges/source/jni_uno/jni_data.cxx | 33 ++++---- bridges/source/jni_uno/jni_info.cxx | 108 +++++++++++++------------- bridges/source/jni_uno/jni_java2uno.cxx | 118 ++++++++++++----------------- bridges/source/jni_uno/jni_uno2java.cxx | 129 ++++++++++++-------------------- 6 files changed, 209 insertions(+), 279 deletions(-) (limited to 'bridges/source') diff --git a/bridges/source/jni_uno/jni_base.h b/bridges/source/jni_uno/jni_base.h index b8bf0c277a5e..9c06ab4ddd4a 100644 --- a/bridges/source/jni_uno/jni_base.h +++ b/bridges/source/jni_uno/jni_base.h @@ -20,6 +20,10 @@ #ifndef INCLUDED_JNI_BASE_H #define INCLUDED_JNI_BASE_H +#include + +#include + #include "jvmaccess/unovirtualmachine.hxx" #include "jvmaccess/virtualmachine.hxx" @@ -208,7 +212,7 @@ inline void JLocalAutoRef::reset( jobject jo ) //______________________________________________________________________________ inline JLocalAutoRef & JLocalAutoRef::operator = ( JLocalAutoRef & auto_ref ) { - OSL_ASSERT( m_jni.get_jni_env() == auto_ref.m_jni.get_jni_env() ); + assert( m_jni.get_jni_env() == auto_ref.m_jni.get_jni_env() ); reset( auto_ref.m_jo ); auto_ref.m_jo = 0; return *this; diff --git a/bridges/source/jni_uno/jni_bridge.cxx b/bridges/source/jni_uno/jni_bridge.cxx index 8f77ad52393a..056e26937aed 100644 --- a/bridges/source/jni_uno/jni_bridge.cxx +++ b/bridges/source/jni_uno/jni_bridge.cxx @@ -17,9 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include "jni_bridge.h" +#include #include "jvmaccess/unovirtualmachine.hxx" #include "rtl/ref.hxx" #include "rtl/strbuf.hxx" @@ -61,8 +65,9 @@ void SAL_CALL Mapping_map_to_uno( uno_Interface ** ppUnoI = (uno_Interface **)ppOut; jobject javaI = (jobject) pIn; - OSL_ASSERT( sizeof (void *) == sizeof (jobject) ); - OSL_ENSURE( ppUnoI && td, "### null ptr!" ); + BOOST_STATIC_ASSERT( sizeof (void *) == sizeof (jobject) ); + assert(ppUnoI != 0); + assert(td != 0); if (0 == javaI) { @@ -98,21 +103,13 @@ void SAL_CALL Mapping_map_to_uno( } catch (const BridgeRuntimeError & err) { -#if OSL_DEBUG_LEVEL > 0 - OString cstr_msg( - OUStringToOString( - "[jni_uno bridge error] " + err.m_message, - RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr_msg.getStr() ); -#else - (void) err; // unused -#endif + SAL_WARN( + "bridges", + "ingoring BridgeRuntimeError \"" << err.m_message << "\""); } catch (const ::jvmaccess::VirtualMachine::AttachGuard::CreationException &) { - OSL_FAIL( - "[jni_uno bridge error] attaching current thread " - "to java failed!" ); + SAL_WARN("bridges", "attaching current thread to java failed"); } } } @@ -126,8 +123,9 @@ void SAL_CALL Mapping_map_to_java( jobject * ppJavaI = (jobject *) ppOut; uno_Interface * pUnoI = (uno_Interface *)pIn; - OSL_ASSERT( sizeof (void *) == sizeof (jobject) ); - OSL_ENSURE( ppJavaI && td, "### null ptr!" ); + BOOST_STATIC_ASSERT( sizeof (void *) == sizeof (jobject) ); + assert(ppJavaI != 0); + assert(td != 0); try { @@ -167,20 +165,13 @@ void SAL_CALL Mapping_map_to_java( } catch (const BridgeRuntimeError & err) { -#if OSL_DEBUG_LEVEL > 0 - OString cstr_msg( - OUStringToOString( - "[jni_uno bridge error] " + err.m_message, - RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr_msg.getStr() ); -#else - (void) err; // unused -#endif + SAL_WARN( + "bridges", + "ingoring BridgeRuntimeError \"" << err.m_message << "\""); } catch (const ::jvmaccess::VirtualMachine::AttachGuard::CreationException &) { - OSL_FAIL( - "[jni_uno bridge error] attaching current thread to java failed!" ); + SAL_WARN("bridges", "attaching current thread to java failed"); } } @@ -247,7 +238,8 @@ Bridge::Bridge( reinterpret_cast< ::jvmaccess::UnoVirtualMachine * >( m_java_env->pContext ) ); - OSL_ASSERT( 0 != m_java_env && 0 != m_uno_env ); + assert(m_java_env != 0); + assert(m_uno_env != 0); (*((uno_Environment *)m_uno_env)->acquire)( (uno_Environment *)m_uno_env ); (*m_java_env->acquire)( m_java_env ); @@ -278,7 +270,7 @@ void JNI_context::java_exc_occurred() const JLocalAutoRef jo_exc( *this, m_env->ExceptionOccurred() ); m_env->ExceptionClear(); - OSL_ASSERT( jo_exc.is() ); + assert(jo_exc.is()); if (! jo_exc.is()) { throw BridgeRuntimeError( @@ -305,7 +297,7 @@ void JNI_context::java_exc_occurred() const "cannot get method id of java.lang.Object.toString()!" + get_stack_trace() ); } - OSL_ASSERT( 0 != method_Object_toString ); + assert(method_Object_toString != 0); JLocalAutoRef jo_descr( *this, m_env->CallObjectMethodA( @@ -450,7 +442,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_initEnvironment( uno_Environment * java_e { java_env->environmentDisposing = java_env_disposing; java_env->pExtEnv = 0; // no extended support - OSL_ASSERT( 0 != java_env->pContext ); + assert(java_env->pContext != 0); ::jvmaccess::UnoVirtualMachine * machine = reinterpret_cast< ::jvmaccess::UnoVirtualMachine * >( @@ -467,23 +459,25 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( uno_Mapping ** ppMapping, uno_Environment * pFrom, uno_Environment * pTo ) SAL_THROW_EXTERN_C() { - OSL_ASSERT( 0 != ppMapping && 0 != pFrom && 0 != pTo ); + assert(ppMapping != 0); + assert(pFrom != 0); + assert(pTo != 0); if (0 != *ppMapping) { (*(*ppMapping)->release)( *ppMapping ); *ppMapping = 0; } - OSL_ASSERT( JNI_FALSE == sal_False ); - OSL_ASSERT( JNI_TRUE == sal_True ); - OSL_ASSERT( sizeof (jboolean) == sizeof (sal_Bool) ); - OSL_ASSERT( sizeof (jchar) == sizeof (sal_Unicode) ); - OSL_ASSERT( sizeof (jdouble) == sizeof (double) ); - OSL_ASSERT( sizeof (jfloat) == sizeof (float) ); - OSL_ASSERT( sizeof (jbyte) == sizeof (sal_Int8) ); - OSL_ASSERT( sizeof (jshort) == sizeof (sal_Int16) ); - OSL_ASSERT( sizeof (jint) == sizeof (sal_Int32) ); - OSL_ASSERT( sizeof (jlong) == sizeof (sal_Int64) ); + BOOST_STATIC_ASSERT( JNI_FALSE == sal_False ); + BOOST_STATIC_ASSERT( JNI_TRUE == sal_True ); + BOOST_STATIC_ASSERT( sizeof (jboolean) == sizeof (sal_Bool) ); + BOOST_STATIC_ASSERT( sizeof (jchar) == sizeof (sal_Unicode) ); + BOOST_STATIC_ASSERT( sizeof (jdouble) == sizeof (double) ); + BOOST_STATIC_ASSERT( sizeof (jfloat) == sizeof (float) ); + BOOST_STATIC_ASSERT( sizeof (jbyte) == sizeof (sal_Int8) ); + BOOST_STATIC_ASSERT( sizeof (jshort) == sizeof (sal_Int16) ); + BOOST_STATIC_ASSERT( sizeof (jint) == sizeof (sal_Int32) ); + BOOST_STATIC_ASSERT( sizeof (jlong) == sizeof (sal_Int64) ); if ((JNI_FALSE == sal_False) && (JNI_TRUE == sal_True) && (sizeof (jboolean) == sizeof (sal_Bool)) && @@ -525,21 +519,13 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( } catch (const BridgeRuntimeError & err) { -#if OSL_DEBUG_LEVEL > 0 - OString cstr_msg( - OUStringToOString( - "[jni_uno bridge error] " + err.m_message, - RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr_msg.getStr() ); -#else - (void) err; // unused -#endif + SAL_WARN( + "bridges", + "ingoring BridgeRuntimeError \"" << err.m_message << "\""); } catch (const ::jvmaccess::VirtualMachine::AttachGuard::CreationException &) { - OSL_FAIL( - "[jni_uno bridge error] attaching current thread " - "to java failed!" ); + SAL_WARN("bridges", "attaching current thread to java failed"); } *ppMapping = mapping; diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx index cece43ac96ba..8995223fbcfb 100644 --- a/bridges/source/jni_uno/jni_data.cxx +++ b/bridges/source/jni_uno/jni_data.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include "jni_bridge.h" @@ -111,7 +114,7 @@ void createDefaultUnoValue( } *static_cast< typelib_TypeDescriptionReference ** >(uno_data) = *typelib_static_type_getByTypeClass(typelib_TypeClass_VOID); - OSL_ASSERT( + assert( *static_cast< typelib_TypeDescriptionReference ** >(uno_data) != 0); typelib_typedescriptionreference_acquire( *static_cast< typelib_TypeDescriptionReference ** >(uno_data)); @@ -205,7 +208,7 @@ void createDefaultUnoValue( break; default: - OSL_ASSERT(false); + assert(false); break; } } @@ -220,7 +223,7 @@ void Bridge::map_to_uno( bool assign, bool out_param, bool special_wrapped_integral_types ) const { - OSL_ASSERT( + assert( !out_param || (1 == jni->GetArrayLength( (jarray) java_data.l )) ); @@ -504,16 +507,6 @@ void Bridge::map_to_uno( // create type out of class JLocalAutoRef jo_class( jni, jni->GetObjectClass( java_data.l ) ); jo_type.reset( create_type( jni, (jclass) jo_class.get() ) ); -#if OSL_DEBUG_LEVEL > 1 - { - JLocalAutoRef jo_toString( - jni, jni->CallObjectMethodA( - java_data.l, m_jni_info->m_method_Object_toString, 0 ) ); - jni.ensure_no_exception(); - OUString toString( - jstring_to_oustring( jni, (jstring) jo_toString.get() ) ); - } -#endif } // get type name @@ -935,7 +928,7 @@ void Bridge::map_to_uno( if (0 == field_id) { // special for Message: call Throwable.getMessage() - OSL_ASSERT( + assert( type_equals( type, m_jni_info->m_Exception_type.getTypeLibType() ) @@ -943,7 +936,7 @@ void Bridge::map_to_uno( type, m_jni_info->m_RuntimeException_type. getTypeLibType() ) ); - OSL_ASSERT( 0 == nPos ); // first member + assert( 0 == nPos ); // first member // call getMessage() jo_field.reset( jni->CallObjectMethodA( @@ -1570,7 +1563,7 @@ void Bridge::map_to_java( } else { - OSL_ASSERT( in_param ); + assert( in_param ); java_data->l = ustring_to_jstring( jni, *(rtl_uString * const *) uno_data ); } @@ -1604,7 +1597,7 @@ void Bridge::map_to_java( } else { - OSL_ASSERT( in_param ); + assert( in_param ); java_data->l = create_type( jni, @@ -1774,7 +1767,7 @@ void Bridge::map_to_java( // polymorphic struct types: OUString const & name = OUString::unacquired( &pAny->pType->pTypeName); - OSL_ASSERT(!name.isEmpty()); + assert(!name.isEmpty()); if (name[name.getLength() - 1] == '>') { // Box up in com.sun.star.uno.Any: @@ -1850,7 +1843,7 @@ void Bridge::map_to_java( jmethodID method_id = jni->GetStaticMethodID( (jclass) jo_enum_class.get(), "fromInt", sig.getStr() ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != method_id ); + assert( 0 != method_id ); jvalue arg; arg.i = *(jint const *) uno_data; @@ -2339,7 +2332,7 @@ void Bridge::map_to_java( jmethodID method_id = jni->GetStaticMethodID( (jclass) jo_enum_class.get(), "fromInt", sig.getStr() ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != method_id ); + assert( 0 != method_id ); sal_Int32 const * p = (sal_Int32 const *)seq->elements; for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos ) diff --git a/bridges/source/jni_uno/jni_info.cxx b/bridges/source/jni_uno/jni_info.cxx index ad0b52b46368..79cabe2a3534 100644 --- a/bridges/source/jni_uno/jni_info.cxx +++ b/bridges/source/jni_uno/jni_info.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include + #include "jni_bridge.h" #include "com/sun/star/uno/RuntimeException.hpp" @@ -69,7 +73,7 @@ JNI_interface_type_info::JNI_interface_type_info( JNI_context const & jni, typelib_TypeDescription * td_ ) : JNI_type_info( jni, td_ ) { - OSL_ASSERT( typelib_TypeClass_INTERFACE == m_td.get()->eTypeClass ); + assert( typelib_TypeClass_INTERFACE == m_td.get()->eTypeClass ); OUString const & uno_name = OUString::unacquired( &m_td.get()->pTypeName ); JNI_info const * jni_info = jni.get_info(); @@ -143,12 +147,12 @@ JNI_interface_type_info::JNI_interface_type_info( (jclass) jo_class.get(), method_name.getStr(), method_signature.getStr() ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_methods[ nMethodIndex ] ); + assert( 0 != m_methods[ nMethodIndex ] ); ++nMethodIndex; } else // attribute { - OSL_ASSERT( + assert( typelib_TypeClass_INTERFACE_ATTRIBUTE == member_td.get()->eTypeClass ); typelib_InterfaceAttributeTypeDescription * attribute_td = @@ -181,7 +185,7 @@ JNI_interface_type_info::JNI_interface_type_info( (jclass) jo_class.get(), method_name.getStr(), method_signature.getStr() ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_methods[ nMethodIndex ] ); + assert( 0 != m_methods[ nMethodIndex ] ); ++nMethodIndex; if (! attribute_td->bReadOnly) { @@ -201,7 +205,7 @@ JNI_interface_type_info::JNI_interface_type_info( (jclass) jo_class.get(), method_name.getStr(), method_signature.getStr() ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_methods[ nMethodIndex ] ); + assert( 0 != m_methods[ nMethodIndex ] ); ++nMethodIndex; } } @@ -234,7 +238,7 @@ JNI_compound_type_info::JNI_compound_type_info( m_exc_ctor( 0 ), m_fields( 0 ) { - OSL_ASSERT( typelib_TypeClass_STRUCT == m_td.get()->eTypeClass || + assert( typelib_TypeClass_STRUCT == m_td.get()->eTypeClass || typelib_TypeClass_EXCEPTION == m_td.get()->eTypeClass ); typelib_CompoundTypeDescription * td = reinterpret_cast< typelib_CompoundTypeDescription * >( m_td.get() ); @@ -265,7 +269,7 @@ JNI_compound_type_info::JNI_compound_type_info( m_exc_ctor = jni->GetMethodID( (jclass) jo_class.get(), "", "(Ljava/lang/String;)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_exc_ctor ); + assert( 0 != m_exc_ctor ); } // retrieve info for base type @@ -293,7 +297,7 @@ JNI_compound_type_info::JNI_compound_type_info( m_fields[ 1 ] = jni->GetFieldID( (jclass) jo_class.get(), "Context", "Ljava/lang/Object;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_fields[ 1 ] ); + assert( 0 != m_fields[ 1 ] ); } else { @@ -326,7 +330,7 @@ JNI_compound_type_info::JNI_compound_type_info( (jclass) jo_class.get(), member_name.getStr(), sig.getStr() ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_fields[ nPos ] ); + assert( 0 != m_fields[ nPos ] ); } } } @@ -544,162 +548,162 @@ JNI_info::JNI_info( m_method_Object_toString = jni->GetMethodID( (jclass) jo_Object.get(), "toString", "()Ljava/lang/String;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Object_toString ); + assert( 0 != m_method_Object_toString ); // method Class.getName() m_method_Class_getName = jni->GetMethodID( (jclass) jo_Class.get(), "getName", "()Ljava/lang/String;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Class_getName ); + assert( 0 != m_method_Class_getName ); // method Throwable.getMessage() m_method_Throwable_getMessage = jni->GetMethodID( (jclass) jo_Throwable.get(), "getMessage", "()Ljava/lang/String;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Throwable_getMessage ); + assert( 0 != m_method_Throwable_getMessage ); // method Character.charValue() m_method_Character_charValue = jni->GetMethodID( (jclass) jo_Character.get(), "charValue", "()C" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Character_charValue ); + assert( 0 != m_method_Character_charValue ); // method Boolean.booleanValue() m_method_Boolean_booleanValue = jni->GetMethodID( (jclass) jo_Boolean.get(), "booleanValue", "()Z" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Boolean_booleanValue ); + assert( 0 != m_method_Boolean_booleanValue ); // method Byte.byteValue() m_method_Byte_byteValue = jni->GetMethodID( (jclass) jo_Byte.get(), "byteValue", "()B" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Byte_byteValue ); + assert( 0 != m_method_Byte_byteValue ); // method Short.shortValue() m_method_Short_shortValue = jni->GetMethodID( (jclass) jo_Short.get(), "shortValue", "()S" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Short_shortValue ); + assert( 0 != m_method_Short_shortValue ); // method Integer.intValue() m_method_Integer_intValue = jni->GetMethodID( (jclass) jo_Integer.get(), "intValue", "()I" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Integer_intValue ); + assert( 0 != m_method_Integer_intValue ); // method Long.longValue() m_method_Long_longValue = jni->GetMethodID( (jclass) jo_Long.get(), "longValue", "()J" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Long_longValue ); + assert( 0 != m_method_Long_longValue ); // method Float.floatValue() m_method_Float_floatValue = jni->GetMethodID( (jclass) jo_Float.get(), "floatValue", "()F" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Float_floatValue ); + assert( 0 != m_method_Float_floatValue ); // method Double.doubleValue() m_method_Double_doubleValue = jni->GetMethodID( (jclass) jo_Double.get(), "doubleValue", "()D" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_Double_doubleValue ); + assert( 0 != m_method_Double_doubleValue ); // ctor Character( char ) m_ctor_Character_with_char = jni->GetMethodID( (jclass) jo_Character.get(), "", "(C)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Character_with_char ); + assert( 0 != m_ctor_Character_with_char ); // ctor Boolean( boolean ) m_ctor_Boolean_with_boolean = jni->GetMethodID( (jclass) jo_Boolean.get(), "", "(Z)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Boolean_with_boolean ); + assert( 0 != m_ctor_Boolean_with_boolean ); // ctor Byte( byte ) m_ctor_Byte_with_byte = jni->GetMethodID( (jclass) jo_Byte.get(), "", "(B)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Byte_with_byte ); + assert( 0 != m_ctor_Byte_with_byte ); // ctor Short( short ) m_ctor_Short_with_short = jni->GetMethodID( (jclass) jo_Short.get(), "", "(S)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Short_with_short ); + assert( 0 != m_ctor_Short_with_short ); // ctor Integer( int ) m_ctor_Integer_with_int = jni->GetMethodID( (jclass) jo_Integer.get(), "", "(I)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Integer_with_int ); + assert( 0 != m_ctor_Integer_with_int ); // ctor Long( long ) m_ctor_Long_with_long = jni->GetMethodID( (jclass) jo_Long.get(), "", "(J)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Long_with_long ); + assert( 0 != m_ctor_Long_with_long ); // ctor Float( float ) m_ctor_Float_with_float = jni->GetMethodID( (jclass) jo_Float.get(), "", "(F)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Float_with_float ); + assert( 0 != m_ctor_Float_with_float ); // ctor Double( double ) m_ctor_Double_with_double = jni->GetMethodID( (jclass) jo_Double.get(), "", "(D)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Double_with_double ); + assert( 0 != m_ctor_Double_with_double ); // static method UnoRuntime.generateOid() m_method_UnoRuntime_generateOid = jni->GetStaticMethodID( (jclass) jo_UnoRuntime.get(), "generateOid", "(Ljava/lang/Object;)Ljava/lang/String;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_UnoRuntime_generateOid ); + assert( 0 != m_method_UnoRuntime_generateOid ); // static method UnoRuntime.queryInterface() m_method_UnoRuntime_queryInterface = jni->GetStaticMethodID( (jclass) jo_UnoRuntime.get(), "queryInterface", "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)Ljava/lang/Object;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_UnoRuntime_queryInterface ); + assert( 0 != m_method_UnoRuntime_queryInterface ); // field Enum.m_value m_field_Enum_m_value = jni->GetFieldID( (jclass) jo_Enum.get(), "m_value", "I" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_field_Enum_m_value ); + assert( 0 != m_field_Enum_m_value ); // static method TypeClass.fromInt() m_method_TypeClass_fromInt = jni->GetStaticMethodID( (jclass) jo_TypeClass.get(), "fromInt", "(I)Lcom/sun/star/uno/TypeClass;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_TypeClass_fromInt ); + assert( 0 != m_method_TypeClass_fromInt ); // ctor Type( Class ) m_ctor_Type_with_Class = jni->GetMethodID( (jclass) jo_Type.get(), "", "(Ljava/lang/Class;)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Type_with_Class ); + assert( 0 != m_ctor_Type_with_Class ); // ctor Type( String, TypeClass ) m_ctor_Type_with_Name_TypeClass = jni->GetMethodID( (jclass) jo_Type.get(), "", "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Type_with_Name_TypeClass ); + assert( 0 != m_ctor_Type_with_Name_TypeClass ); // field Type._typeName m_field_Type__typeName = jni->GetFieldID( (jclass) jo_Type.get(), "_typeName", "Ljava/lang/String;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_field_Type__typeName ); + assert( 0 != m_field_Type__typeName ); // ctor Any( Type, Object ) m_ctor_Any_with_Type_Object = jni->GetMethodID( (jclass) jo_Any.get(), "", "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_ctor_Any_with_Type_Object ); + assert( 0 != m_ctor_Any_with_Type_Object ); // field Any._type m_field_Any__type = jni->GetFieldID( (jclass) jo_Any.get(), "_type", "Lcom/sun/star/uno/Type;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_field_Any__type ); + assert( 0 != m_field_Any__type ); // field Any._object m_field_Any__object = jni->GetFieldID( (jclass) jo_Any.get(), "_object", "Ljava/lang/Object;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_field_Any__object ); + assert( 0 != m_field_Any__object ); // method IEnvironment.getRegisteredInterface() m_method_IEnvironment_getRegisteredInterface = jni->GetMethodID( @@ -707,48 +711,48 @@ JNI_info::JNI_info( "getRegisteredInterface", "(Ljava/lang/String;Lcom/sun/star/uno/Type;)Ljava/lang/Object;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_IEnvironment_getRegisteredInterface ); + assert( 0 != m_method_IEnvironment_getRegisteredInterface ); // method IEnvironment.registerInterface() m_method_IEnvironment_registerInterface = jni->GetMethodID( (jclass) jo_IEnvironment.get(), "registerInterface", "(Ljava/lang/Object;[Ljava/lang/String;Lcom/sun/star/uno/Type;)" "Ljava/lang/Object;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_IEnvironment_registerInterface ); + assert( 0 != m_method_IEnvironment_registerInterface ); // static method JNI_proxy.get_proxy_ctor() m_method_JNI_proxy_get_proxy_ctor = jni->GetStaticMethodID( (jclass) jo_JNI_proxy.get(), "get_proxy_ctor", "(Ljava/lang/Class;)Ljava/lang/reflect/Constructor;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_JNI_proxy_get_proxy_ctor ); + assert( 0 != m_method_JNI_proxy_get_proxy_ctor ); // static method JNI_proxy.create() m_method_JNI_proxy_create = jni->GetStaticMethodID( (jclass) jo_JNI_proxy.get(), "create", "(JLcom/sun/star/uno/IEnvironment;JJLcom/sun/star/uno/Type;Ljava/lang" "/String;Ljava/lang/reflect/Constructor;)Ljava/lang/Object;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_method_JNI_proxy_create ); + assert( 0 != m_method_JNI_proxy_create ); // field JNI_proxy.m_receiver_handle m_field_JNI_proxy_m_receiver_handle = jni->GetFieldID( (jclass) jo_JNI_proxy.get(), "m_receiver_handle", "J" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_field_JNI_proxy_m_receiver_handle ); + assert( 0 != m_field_JNI_proxy_m_receiver_handle ); // field JNI_proxy.m_td_handle m_field_JNI_proxy_m_td_handle = jni->GetFieldID( (jclass) jo_JNI_proxy.get(), "m_td_handle", "J" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_field_JNI_proxy_m_td_handle ); + assert( 0 != m_field_JNI_proxy_m_td_handle ); // field JNI_proxy.m_type m_field_JNI_proxy_m_type = jni->GetFieldID( (jclass) jo_JNI_proxy.get(), "m_type", "Lcom/sun/star/uno/Type;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_field_JNI_proxy_m_type ); + assert( 0 != m_field_JNI_proxy_m_type ); // field JNI_proxy.m_oid m_field_JNI_proxy_m_oid = jni->GetFieldID( (jclass) jo_JNI_proxy.get(), "m_oid", "Ljava/lang/String;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != m_field_JNI_proxy_m_oid ); + assert( 0 != m_field_JNI_proxy_m_oid ); // get java env OUString java_env_type_name( UNO_LB_JAVA ); @@ -762,7 +766,7 @@ JNI_info::JNI_info( "(Ljava/lang/String;Ljava/lang/Object;)" "Lcom/sun/star/uno/IEnvironment;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != method_getEnvironment ); + assert( 0 != method_getEnvironment ); JLocalAutoRef jo_java_env( jni, jni->CallStaticObjectMethodA( (jclass) jo_UnoRuntime.get(), method_getEnvironment, args ) ); @@ -771,7 +775,7 @@ JNI_info::JNI_info( jfieldID field_Any_VOID = jni->GetStaticFieldID( (jclass) jo_Any.get(), "VOID", "Lcom/sun/star/uno/Any;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != field_Any_VOID ); + assert( 0 != field_Any_VOID ); JLocalAutoRef jo_Any_VOID( jni, jni->GetStaticObjectField( (jclass) jo_Any.get(), field_Any_VOID ) ); @@ -779,7 +783,7 @@ JNI_info::JNI_info( jfieldID field_Type_UNSIGNED_SHORT = jni->GetStaticFieldID( (jclass) jo_Type.get(), "UNSIGNED_SHORT", "Lcom/sun/star/uno/Type;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != field_Type_UNSIGNED_SHORT ); + assert( 0 != field_Type_UNSIGNED_SHORT ); JLocalAutoRef jo_Type_UNSIGNED_SHORT( jni, jni->GetStaticObjectField( (jclass) jo_Type.get(), field_Type_UNSIGNED_SHORT ) ); @@ -787,7 +791,7 @@ JNI_info::JNI_info( jfieldID field_Type_UNSIGNED_LONG = jni->GetStaticFieldID( (jclass) jo_Type.get(), "UNSIGNED_LONG", "Lcom/sun/star/uno/Type;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != field_Type_UNSIGNED_LONG ); + assert( 0 != field_Type_UNSIGNED_LONG ); JLocalAutoRef jo_Type_UNSIGNED_LONG( jni, jni->GetStaticObjectField( (jclass) jo_Type.get(), field_Type_UNSIGNED_LONG ) ); @@ -795,7 +799,7 @@ JNI_info::JNI_info( jfieldID field_Type_UNSIGNED_HYPER = jni->GetStaticFieldID( (jclass) jo_Type.get(), "UNSIGNED_HYPER", "Lcom/sun/star/uno/Type;" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != field_Type_UNSIGNED_HYPER ); + assert( 0 != field_Type_UNSIGNED_HYPER ); JLocalAutoRef jo_Type_UNSIGNED_HYPER( jni, jni->GetStaticObjectField( (jclass) jo_Type.get(), field_Type_UNSIGNED_HYPER ) ); @@ -929,7 +933,7 @@ JNI_info const * JNI_info::get_jni_info( jni->GetStaticFieldID( (jclass) jo_JNI_info_holder.get(), "s_jni_info_handle", "J" ); jni.ensure_no_exception(); - OSL_ASSERT( 0 != field_s_jni_info_handle ); + assert( 0 != field_s_jni_info_handle ); JNI_info const * jni_info = reinterpret_cast< JNI_info const * >( diff --git a/bridges/source/jni_uno/jni_java2uno.cxx b/bridges/source/jni_uno/jni_java2uno.cxx index b6a200ea46f5..b9d12aa5d837 100644 --- a/bridges/source/jni_uno/jni_java2uno.cxx +++ b/bridges/source/jni_uno/jni_java2uno.cxx @@ -17,7 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include #include #include "jni_bridge.h" @@ -40,7 +42,7 @@ jobject Bridge::map_to_java( // get oid rtl_uString * pOid = 0; (*m_uno_env->getObjectIdentifier)( m_uno_env, &pOid, pUnoI ); - OSL_ASSERT( 0 != pOid ); + assert( 0 != pOid ); OUString oid( pOid, SAL_NO_ACQUIRE ); // opt getRegisteredInterface() @@ -78,7 +80,7 @@ jobject Bridge::map_to_java( jni.ensure_no_exception(); } - OSL_ASSERT( 0 != jo_iface ); + assert( 0 != jo_iface ); return jo_iface; } @@ -93,22 +95,12 @@ void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const reinterpret_cast< ::com::sun::star::uno::Exception * >( uno_exc->pData )->Message += jni.get_stack_trace(); #endif - -#if OSL_DEBUG_LEVEL > 1 - { - OUStringBuffer buf( 128 ); - buf.append( "exception occurred java->uno: [" ); - buf.append( OUString::unacquired( &uno_exc->pType->pTypeName ) ); - buf.append( "] " ); - buf.append( - reinterpret_cast< ::com::sun::star::uno::Exception const * >( - uno_exc->pData )->Message ); - OString cstr_msg( - OUStringToOString( - buf.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "%s", cstr_msg.getStr() ); - } -#endif + SAL_INFO( + "bridges", + "exception occurred java->uno: [" + << OUString::unacquired(&uno_exc->pType->pTypeName) << "] " + << reinterpret_cast( + uno_exc->pData)->Message); // signal exception jvalue java_exc; try @@ -198,7 +190,7 @@ jobject Bridge::call_uno( largest * uno_args_mem = (largest *) (mem + (nParams * sizeof (void *)) + return_size); - OSL_ASSERT( (0 == nParams) || (nParams == jni->GetArrayLength( jo_args )) ); + assert( (0 == nParams) || (nParams == jni->GetArrayLength( jo_args )) ); for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) { typelib_MethodParameter const & param = pParams[ nPos ]; @@ -396,23 +388,17 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( try { method_name = jstring_to_oustring( jni, jo_method ); -#if OSL_DEBUG_LEVEL > 1 - { - OUStringBuffer trace_buf( 64 ); - trace_buf.append( "java->uno call: " ); - trace_buf.append( method_name ); - trace_buf.append( " on oid " ); - JLocalAutoRef jo_oid( - jni, jni->GetObjectField( - jo_proxy, jni_info->m_field_JNI_proxy_m_oid ) ); - trace_buf.append( jstring_to_oustring( jni, (jstring) jo_oid.get() ) ); - OString cstr_msg( - OUStringToOString( - trace_buf.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "%s", cstr_msg.getStr() ); - } -#endif - + SAL_INFO( + "bridges", + "java->uno call: " << method_name << " on oid " + << jstring_to_oustring( + jni, + static_cast( + JLocalAutoRef( + jni, + jni->GetObjectField( + jo_proxy, jni_info->m_field_JNI_proxy_m_oid)) + .get()))); // special IQueryInterface.queryInterface() if ( method_name == "queryInterface" ) { @@ -515,9 +501,9 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( OUString const & type_name = OUString::unacquired( &member_type->pTypeName ); sal_Int32 offset = type_name.indexOf( ':' ) + 2; - OSL_ASSERT( - offset >= 2 && offset < type_name.getLength() - && type_name[offset - 1] == ':' ); + assert(offset >= 2); + assert(offset < type_name.getLength()); + assert(type_name[offset - 1] == ':' ); sal_Int32 remainder = type_name.getLength() - offset; if (typelib_TypeClass_INTERFACE_METHOD == member_type->eTypeClass) { @@ -540,7 +526,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( } else // attribute { - OSL_ASSERT( + assert( typelib_TypeClass_INTERFACE_ATTRIBUTE == member_type->eTypeClass ); @@ -604,35 +590,32 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( } catch (const BridgeRuntimeError & err) { - OUStringBuffer buf( 128 ); - buf.append( "[jni_uno bridge error] " "Java calling UNO method " ); - buf.append( method_name ); - buf.append( ": " ); - buf.append( err.m_message ); + SAL_WARN( + "bridges", + "Java calling UNO method " << method_name << ": " << err.m_message); // notify RuntimeException OString cstr_msg( - OUStringToOString( - buf.makeStringAndClear(), RTL_TEXTENCODING_JAVA_UTF8 ) ); - OSL_FAIL( cstr_msg.getStr() ); + "[jni_uno bridge error] Java calling UNO method " + + OUStringToOString(method_name, RTL_TEXTENCODING_JAVA_UTF8) + ": " + + OUStringToOString(err.m_message, RTL_TEXTENCODING_JAVA_UTF8)); if (jni->ThrowNew(jni_info->m_class_RuntimeException, cstr_msg.getStr()) != 0) { - OSL_ASSERT( false ); + assert( false ); } return 0; } catch (const ::jvmaccess::VirtualMachine::AttachGuard::CreationException &) { + SAL_WARN("bridges", "attaching current thread to java failed"); OString cstr_msg( - OString( "[jni_uno bridge error] " - "attaching current thread to java failed!" ) + - OUStringToOString( - jni.get_stack_trace(), RTL_TEXTENCODING_JAVA_UTF8 ) ); - OSL_FAIL( cstr_msg.getStr() ); + "[jni_uno bridge error] attaching current thread to java failed" + + OUStringToOString( + jni.get_stack_trace(), RTL_TEXTENCODING_JAVA_UTF8)); if (jni->ThrowNew(jni_info->m_class_RuntimeException, cstr_msg.getStr()) != 0) { - OSL_ASSERT( false ); + assert( false ); } return 0; } @@ -659,20 +642,17 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_finalize__J( reinterpret_cast< typelib_TypeDescription * >( jni->GetLongField( jo_proxy, jni_info->m_field_JNI_proxy_m_td_handle ) ); - -#if OSL_DEBUG_LEVEL > 1 - { - JLocalAutoRef jo_oid( - jni, jni->GetObjectField( - jo_proxy, jni_info->m_field_JNI_proxy_m_oid ) ); - OUString oid( jstring_to_oustring( jni, (jstring) jo_oid.get() ) ); - OString cstr_msg( - OUStringToOString( - "freeing java uno proxy: " + oid, - RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "%s", cstr_msg.getStr() ); - } -#endif + SAL_INFO( + "bridges", + "freeing java uno proxy: " + << jstring_to_oustring( + jni, + static_cast( + JLocalAutoRef( + jni, + jni->GetObjectField( + jo_proxy, jni_info->m_field_JNI_proxy_m_oid)) + .get()))); // revoke from uno env; has already been revoked from java env (*bridge->m_uno_env->revokeInterface)( bridge->m_uno_env, pUnoI ); // release receiver diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx index 9ba852f1f7ac..a3200ca2c0f2 100644 --- a/bridges/source/jni_uno/jni_uno2java.cxx +++ b/bridges/source/jni_uno/jni_uno2java.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include @@ -63,7 +66,7 @@ void Bridge::handle_java_exc( JNI_context const & jni, JLocalAutoRef const & jo_exc, uno_Any * uno_exc ) const { - OSL_ASSERT( jo_exc.is() ); + assert( jo_exc.is() ); if (! jo_exc.is()) { throw BridgeRuntimeError( @@ -113,19 +116,11 @@ void Bridge::handle_java_exc( uno_exc->pType = td.get()->pWeakRef; uno_exc->pData = uno_data.release(); -#if OSL_DEBUG_LEVEL > 1 - OUStringBuffer trace_buf( 128 ); - trace_buf.append( "exception occurred uno->java: [" ); - trace_buf.append( exc_name ); - trace_buf.append( "] " ); - trace_buf.append( - reinterpret_cast< ::com::sun::star::uno::Exception const * >( - uno_exc->pData )->Message ); - OString cstr_trace( - OUStringToOString( - trace_buf.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "%s", cstr_trace.getStr() ); -#endif + SAL_INFO( + "bridges", + "exception occurred uno->java: [" << exc_name << "] " + << (reinterpret_cast(uno_exc->pData) + ->Message)); } //______________________________________________________________________________ @@ -136,7 +131,7 @@ void Bridge::call_java( typelib_MethodParameter * params, sal_Int32 nParams, void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) const { - OSL_ASSERT( function_pos_offset == 0 || function_pos_offset == 1 ); + assert( function_pos_offset == 0 || function_pos_offset == 1 ); JNI_guarded_context jni( m_jni_info, reinterpret_cast< ::jvmaccess::UnoVirtualMachine * >( @@ -157,7 +152,7 @@ void Bridge::call_java( } iface_td = reinterpret_cast( iface_holder.get() ); - OSL_ASSERT( iface_td->aBase.eTypeClass == typelib_TypeClass_INTERFACE ); + assert( iface_td->aBase.eTypeClass == typelib_TypeClass_INTERFACE ); } // prepare java args, save param td @@ -201,19 +196,20 @@ void Bridge::call_java( } sal_Int32 base_members = iface_td->nAllMembers - iface_td->nMembers; - OSL_ASSERT( base_members < iface_td->nAllMembers ); + assert( base_members < iface_td->nAllMembers ); sal_Int32 base_members_function_pos = iface_td->pMapMemberIndexToFunctionIndex[ base_members ]; sal_Int32 member_pos = base_members + local_member_index; - OSL_ENSURE( - member_pos < iface_td->nAllMembers, "### member pos out of range!" ); + SAL_WARN_IF( + member_pos >= iface_td->nAllMembers, "bridges", + "member pos out of range"); sal_Int32 function_pos = iface_td->pMapMemberIndexToFunctionIndex[ member_pos ] + function_pos_offset; - OSL_ENSURE( - function_pos >= base_members_function_pos - && function_pos < iface_td->nMapFunctionIndexToMemberIndex, - "### illegal function index!" ); + SAL_WARN_IF( + (function_pos < base_members_function_pos + || function_pos >= iface_td->nMapFunctionIndexToMemberIndex), + "bridges", "illegal function index"); function_pos -= base_members_function_pos; JNI_interface_type_info const * info = @@ -221,7 +217,7 @@ void Bridge::call_java( m_jni_info->get_type_info( jni, &iface_td->aBase ) ); jmethodID method_id = info->m_methods[ function_pos ]; -#if OSL_DEBUG_LEVEL > 1 +#if OSL_DEBUG_LEVEL > 0 OUStringBuffer trace_buf( 128 ); trace_buf.append( "calling " ); JLocalAutoRef jo_method( @@ -246,10 +242,7 @@ void Bridge::call_java( jni.ensure_no_exception(); trace_buf.append( jstring_to_oustring( jni, (jstring) jo_descr.get() ) ); trace_buf.append( ")" ); - OString cstr_trace( - OUStringToOString( - trace_buf.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "%s", cstr_trace.getStr() ); + SAL_INFO("bridges", trace_buf.makeStringAndClear()); #endif // complex return value @@ -476,9 +469,7 @@ inline void UNO_proxy::acquire() const m_bridge->m_uno_env, &that, UNO_proxy_free, m_oid.pData, (typelib_InterfaceTypeDescription *)m_type_info->m_td.get() ); -#if OSL_DEBUG_LEVEL > 1 - OSL_ASSERT( this == (void const * const)that ); -#endif + assert( this == (void const * const)that ); } } @@ -538,16 +529,8 @@ void SAL_CALL UNO_proxy_free( uno_ExtEnvironment * env, void * proxy ) UNO_proxy const * that = reinterpret_cast< UNO_proxy const * >( proxy ); Bridge const * bridge = that->m_bridge; - if ( env != bridge->m_uno_env ) { - OSL_ASSERT(false); - } -#if OSL_DEBUG_LEVEL > 1 - OString cstr_msg( - OUStringToOString( - "freeing binary uno proxy: " + that->m_oid, - RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "%s", cstr_msg.getStr() ); -#endif + assert(env == bridge->m_uno_env); + SAL_INFO("bridges", "freeing binary uno proxy: " << that->m_oid); try { @@ -561,22 +544,17 @@ void SAL_CALL UNO_proxy_free( uno_ExtEnvironment * env, void * proxy ) } catch (BridgeRuntimeError & err) { -#if OSL_DEBUG_LEVEL > 0 - OString cstr_msg2( - OUStringToOString( err.m_message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr_msg2.getStr() ); -#else - (void) err; // unused -#endif + SAL_WARN( + "bridges", + "ignoring BridgeRuntimeError \"" << err.m_message << "\""); } catch (::jvmaccess::VirtualMachine::AttachGuard::CreationException &) { - OSL_FAIL( - "[jni_uno bridge error] attaching current thread to java failed!" ); + SAL_WARN("bridges", "attaching current thread to java failed"); } bridge->release(); -#if OSL_DEBUG_LEVEL > 1 +#if OSL_DEBUG_LEVEL > 0 *(int *)that = 0xdeadcafe; #endif delete that; @@ -607,17 +585,10 @@ void SAL_CALL UNO_proxy_dispatch( UNO_proxy const * that = static_cast< UNO_proxy const * >( pUnoI ); Bridge const * bridge = that->m_bridge; -#if OSL_DEBUG_LEVEL > 1 - OUStringBuffer trace_buf( 64 ); - trace_buf.append( "uno->java call: " ); - trace_buf.append( OUString::unacquired( &member_td->pTypeName ) ); - trace_buf.append( " on oid " ); - trace_buf.append( that->m_oid ); - OString cstr_msg( - OUStringToOString( - trace_buf.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "%s", cstr_msg.getStr() ); -#endif + SAL_INFO( + "bridges", + "uno->java call: " << OUString::unacquired(&member_td->pTypeName) + << " on oid " << that->m_oid); try { @@ -633,7 +604,7 @@ void SAL_CALL UNO_proxy_dispatch( while ( attrib_td->pBaseRef != 0 ) { attrib_holder = com::sun::star::uno::TypeDescription( attrib_td->pBaseRef ); - OSL_ASSERT( + assert( attrib_holder.get()->eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE ); attrib_td = reinterpret_cast< @@ -676,7 +647,7 @@ void SAL_CALL UNO_proxy_dispatch( while ( method_td->pBaseRef != 0 ) { method_holder = com::sun::star::uno::TypeDescription( method_td->pBaseRef ); - OSL_ASSERT( + assert( method_holder.get()->eTypeClass == typelib_TypeClass_INTERFACE_METHOD ); method_td = reinterpret_cast< @@ -737,15 +708,15 @@ void SAL_CALL UNO_proxy_dispatch( { if (jo_ret.is()) { -#if OSL_DEBUG_LEVEL > 0 - JLocalAutoRef jo_oid( - jni, compute_oid( jni, jo_ret.get() ) ); - OUString oid( jstring_to_oustring( - jni, (jstring) jo_oid.get() ) ); - OSL_ENSURE( - oid.equals( that->m_oid ), - "### different oids!" ); -#endif + SAL_WARN_IF( + (jstring_to_oustring( + jni, + static_cast( + JLocalAutoRef( + jni, compute_oid(jni, jo_ret.get())) + .get())) + != that->m_oid), + "bridges", "different oids"); // refcount initially 1 uno_Interface * pUnoI2 = new UNO_proxy( jni, bridge, jo_ret.get(), @@ -830,11 +801,7 @@ void SAL_CALL UNO_proxy_dispatch( ::com::sun::star::uno::XInterface >() ); ::com::sun::star::uno::Type const & exc_type = ::getCppuType( &exc ); uno_type_any_construct( *uno_exc, &exc, exc_type.getTypeLibType(), 0 ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr_msg2( - OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_TRACE( "%s", cstr_msg2.getStr() ); -#endif + SAL_INFO("bridges", exc.Message); } catch (::jvmaccess::VirtualMachine::AttachGuard::CreationException &) { @@ -845,11 +812,7 @@ void SAL_CALL UNO_proxy_dispatch( ::com::sun::star::uno::XInterface >() ); ::com::sun::star::uno::Type const & exc_type = ::getCppuType( &exc ); uno_type_any_construct( *uno_exc, &exc, exc_type.getTypeLibType(), 0 ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr_msg2( - OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr_msg2.getStr() ); -#endif + SAL_WARN("bridges", exc.Message); } } -- cgit