harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r446861 - /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp
Date Sat, 16 Sep 2006 12:11:58 GMT
Author: geirm
Date: Sat Sep 16 05:11:57 2006
New Revision: 446861

URL: http://svn.apache.org/viewvc?view=rev&rev=446861
Log:
HARMONY-1432

The classlib test tests.api.java.lang.reflect.FieldTest crashes DRLVM

 Fixed by adding missing check to dissallow reading primitive value from reference field.

Passes c-unit and smoke on ubuntu


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp?view=diff&rev=446861&r1=446860&r2=446861
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/java_lang_reflect_VMField.cpp
Sat Sep 16 05:11:57 2006
@@ -87,7 +87,7 @@
         GetBooleanField(jenv, obj, field_id);
         break;
     default:
-        ASSERT(0, "Unexpected type descriptor");
+        ASSERT(0, "Unexpected type descriptor: " << field_sig);
     }
 
     return primitive_value;
@@ -99,9 +99,15 @@
 
     TRACE("read field value : " << field);
 
-    char field_sig = field->get_descriptor()->bytes[0];
-    jvalue result = read_primitive(jenv, (jfieldID)field, obj, field_sig);
-    if (!widen_primitive_jvalue(&result, field_sig, to_type) && !exn_raised())
{
+    jvalue result;
+    if (field->get_field_type_desc()->is_primitive()) {
+        char field_sig = field->get_descriptor()->bytes[0];
+        result = read_primitive(jenv, (jfieldID)field, obj, field_sig);
+        if (widen_primitive_jvalue(&result, field_sig, to_type)) {
+            return result;
+        }
+    }
+    if (!exn_raised()) {
         ThrowNew_Quick(jenv, "java/lang/IllegalArgumentException", field->get_descriptor()->bytes);
     }
     return result;



Mime
View raw message