@@ -144,7 +144,15 @@ public Message(Parcel in) {
144144 topicId = in .readString ();
145145 connected = in .readByte () != 0 ;
146146 contentType = (short ) in .readInt ();
147- metadata = in .readHashMap (String .class .getClassLoader ());
147+ int metadataSize = in .readInt ();
148+ metadata = new HashMap <>();
149+ for (int i = 0 ; i < metadataSize ; i ++) {
150+ String key = in .readString ();
151+ String value = in .readString ();
152+ if (key != null ) {
153+ metadata .put (key , value );
154+ }
155+ }
148156 status = (short ) in .readInt ();
149157 hidden = in .readByte () != 0 ;
150158 replyMessage = in .readInt ();
@@ -896,7 +904,16 @@ public void writeToParcel(Parcel dest, int flags) {
896904 dest .writeString (topicId );
897905 dest .writeByte ((byte ) (connected ? 1 : 0 ));
898906 dest .writeInt (contentType );
899- dest .writeMap (metadata );
907+ // dest.writeMap(metadata);
908+ if (metadata != null ) {
909+ dest .writeInt (metadata .size ());
910+ for (Map .Entry <String , String > entry : metadata .entrySet ()) {
911+ dest .writeString (entry .getKey ());
912+ dest .writeString (entry .getValue ());
913+ }
914+ } else {
915+ dest .writeInt (0 );
916+ }
900917 dest .writeInt (status );
901918 dest .writeByte ((byte ) (hidden ? 1 : 0 ));
902919 dest .writeInt (replyMessage );
0 commit comments