diff options
author | Tor Lillqvist <tlillqvist@suse.com> | 2012-03-26 17:45:52 +0300 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2012-03-26 17:53:21 +0300 |
commit | b5ca34fa409bc4cbeb41a84b900612e302f5b0fb (patch) | |
tree | 8f61effda01735addc9199dfa26965d33b2a1235 /bridges | |
parent | 7d6656addebcaec4f8873e4a611a970a224a7bf5 (diff) |
Field IDs on Dalvik are more unique than in JVMs
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/source/jni_uno/jni_data.cxx | 21 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_info.cxx | 5 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_info.h | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx index 9d77812ada04..cabca76e8fc4 100644 --- a/bridges/source/jni_uno/jni_data.cxx +++ b/bridges/source/jni_uno/jni_data.cxx @@ -1968,7 +1968,26 @@ void Bridge::map_to_java( comp_td)->pParameterizedTypes != 0; for ( sal_Int32 nPos = comp_td->nMembers; nPos--; ) { - jfieldID field_id = linfo->m_fields[ nPos ]; + jfieldID field_id; + + // Handle com.sun.star.uno.RuntimeException::Context as a + // special case. In (C++) UNO css::uno::RuntimeException + // is simply a subclass of css::uno::Exception, which + // contains the Context field. In the Java UNO mapping + // css.uno.RuntimeException is a subclass of + // java.lang.RuntimeException, and has a Context field of + // its own, separate from that of css.uno.Exception. + + // In Dalvik the field IDs of these Context fields + // differ. (In Java VMs they seem to be the same.) + + if (type_equals( comp_info->m_td.get()->pWeakRef, + m_jni_info->m_RuntimeException_type.getTypeLibType() ) + && nPos == 1) + field_id = m_jni_info->m_field_css_uno_RuntimeException_m_Context; + else + field_id = linfo->m_fields[ nPos ]; + if (0 != field_id) { void const * p = diff --git a/bridges/source/jni_uno/jni_info.cxx b/bridges/source/jni_uno/jni_info.cxx index a5ed28aacb5e..1d601cf505bd 100644 --- a/bridges/source/jni_uno/jni_info.cxx +++ b/bridges/source/jni_uno/jni_info.cxx @@ -762,6 +762,11 @@ JNI_info::JNI_info( jni.ensure_no_exception(); OSL_ASSERT( 0 != m_field_JNI_proxy_m_oid ); + m_field_css_uno_RuntimeException_m_Context = jni->GetFieldID( + (jclass) jo_RuntimeException.get(), "Context", "Ljava/lang/Object;" ); + jni.ensure_no_exception(); + OSL_ASSERT( 0 != m_field_css_uno_RuntimeException_m_Context ); + // get java env OUString java_env_type_name( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_JAVA) ); JLocalAutoRef jo_java( diff --git a/bridges/source/jni_uno/jni_info.h b/bridges/source/jni_uno/jni_info.h index a356be272e04..9cdbbf4658c0 100644 --- a/bridges/source/jni_uno/jni_info.h +++ b/bridges/source/jni_uno/jni_info.h @@ -204,6 +204,8 @@ public: jfieldID m_field_JNI_proxy_m_type; jfieldID m_field_JNI_proxy_m_oid; + jfieldID m_field_css_uno_RuntimeException_m_Context; + // ::com::sun::star::uno::TypeDescription m_XInterface_queryInterface_td; ::com::sun::star::uno::Type const & m_Exception_type; |