commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI Fix array class type handling in VMObjectStreamClass


From: Mark Wielaard
Subject: FYI Fix array class type handling in VMObjectStreamClass
Date: Tue, 13 Apr 2004 21:39:16 +0200

Hi,

The release of all the new runtime environments made it easier to test
some subtle serialization issues. One last remaining bug was that the
new code that I introduced handled array types as reference types. This
fixes that.

2004-04-13  Mark Wielaard  <address@hidden>

        * native/jni/java-io/java_io_VMObjectStreamClass.c
        getFieldReference(): Array types are different from reference
        types.

With this all serialization related mauve tests should PASS.

Cheers,

Mark
Index: native/jni/java-io/java_io_VMObjectStreamClass.c
===================================================================
RCS file: 
/cvsroot/classpath/classpath/native/jni/java-io/java_io_VMObjectStreamClass.c,v
retrieving revision 1.5
diff -u -r1.5 java_io_VMObjectStreamClass.c
--- native/jni/java-io/java_io_VMObjectStreamClass.c    11 Apr 2004 21:04:26 
-0000      1.5
+++ native/jni/java-io/java_io_VMObjectStreamClass.c    13 Apr 2004 19:36:30 
-0000
@@ -172,20 +172,32 @@
       type_name = (*env)->GetStringUTFChars(env, tname, NULL);
 
       /*
-       * The actual field type descriptor starts with 'L', ends with ';'
-       * and has '/' instead of '.'.
+       * If it isn't an array class then the actual field type descriptor
+       * starts with 'L', ends with ';' and has '/' instead of '.'.
        */
       type_len = strlen((char *) type_name);
-      type = (char *) malloc(type_len + 3);
-      type[0] = 'L';
-      type[type_len + 1] = ';';
-      type[type_len + 2] = '\0';
+      if (type_name[0] != '[')
+        {
+         type = (char *) malloc(type_len + 3);
+         type[0] = 'L';
+         type[type_len + 1] = ';';
+         type[type_len + 2] = '\0';
+         type++;
+       }
+      else
+       {
+         type = (char *) malloc(type_len);
+         type[type_len] = '\0';
+       }
 
       for (i = 0; i < type_len; i++)
        if (type_name[i] == '.')
-         type[i + 1] = '/';
+         type[i] = '/';
         else
-         type[i + 1] = type_name[i];
+         type[i] = type_name[i];
+
+      if (type_name[0] != '[')
+       type--;
 
       (*env)->ReleaseStringUTFChars(env, tname, type_name);
     }

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]