Hi,
I found a problem in the RTCModel class. When I call fetchItems(room, "default_SimpleChat", "history") to obtain the chat history, the RTCModel fails with an exception:
ClassCastException: Cannot cast java.lang.Double (id=3330) to java.lang.String
The problem is located in the addItem function within the Node inner class:
public void addItem(Map<String, Object> data)
{
String itemID = (String) data.get("itemID");
if (itemID == null)
itemID = "item";
items.put(itemID, new Item(data));
}
The String cast isn't checked and the itemId contains a Double 0.0.
The data returned by the service is:
[default_SimpleChat={
nodes={
history={
items={
0.0={publisherID=EXT-MYACCOUNT-3499,
body={color=0.0, role=10.0, displayName=Test User, msg=test1},
itemID=0.0,
timeStamp=1.282144187104E12,
associatedUserID=EXT-MYACCOUNT-3499,
nodeName=history,
collectionName=default_SimpleChat},
1.0={publisherID=EXT-MYACCOUNT-3499,
body={color=0.0, role=10.0, displayName=Test User, msg=test2},
itemID=1.0,
timeStamp=1.282144188111E12,
associatedUserID=EXT-MYACCOUNT-3499,
nodeName=history,
collectionName=default_SimpleChat}
}
}
}
}To fix the problem, I changed the get to:
String itemID = String.valueOf(data.get("itemID"));Does that make sense?
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
Views
Replies
Total Likes
Thanks! We'll integrate your fix for next version.
Sent from my iPad
Views
Replies
Total Likes