Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[BUG REPORT] com.adobe.rtc.messaging.MessageItem: Doesn't cleanup in createValueObject()

Avatar

Level 3

I'm not sure if you have a publicly available bug tracker. If you do, let me know where it is and I'll post this there.

If you register a class using MessageItem.registerBodyClass() and then call createValueObject(), readValueObject(). MessageItem.body is not the appropriate class.

WhatShouldHappen:

The readValueObject should the MessageItem.body with an object be of the registered class type.

Why it happens:

When MessageItem.createValueObject() creates the ByteArray, it doesn't rewind it when it's done, so when it's time to call MessageItem.readValueObject(), there are no more bytes to be read.

Why we care:

I'm using SessionManagerBase as a loopback server for my unit tests (not in the documentation, but it's in the code). They fail because of this.

How do we fix it?:

The simple solution is changing this:

-------------------------------------------------------------------

     if (registeredClasses[flash.utils.getQualifiedClassName(body)]) {

          var bA:ByteArray = new ByteArray();

          bA.writeObject(body);

          writeObj.body = bA;

     } else {

          writeObj.body = body;

     }

-------------------------------------------------------------------
to this:

-------------------------------------------------------------------

     if (registeredClasses[flash.utils.getQualifiedClassName(body)]) {

          var bA:ByteArray = new ByteArray();

          bA.writeObject(body);

          bA.position = 0;          <--- I added this.

          writeObj.body = bA;

     } else {

          writeObj.body = body;

     }

-------------------------------------------------------------------
thanks,
-sandy

0 Replies

Avatar

Level 3

I should have noted that this bug only seems to occur if you're using SessionManagerBase as a loopback.