Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


The following patch seems to help, does it look sane?

--tml

diff --git a/bridges/source/jni_uno/jni_data.cxx
b/bridges/source/jni_uno/jni_data.cxx
index 9d77812..cabca76 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 a5ed28a..1d601cf 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 a356be2..9cdbbf4 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;

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.