Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected Error on saving object to firebase db? (mClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47))

The error log (part of it) I'm getting:

mClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)`2019-01-03 11:48:45.070 28064-28064/com.example.xandi.whib E/AndroidRuntime:     at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@16.0.5:167)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$200(com.google.firebase:firebase-database@@16.0.5:47)
    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.serialize(com.google.firebase:firebase-database@@16.0.5:663)

read: unexpected EOF!

`

Here is the code of what I'm trying to do:

private void createNewGroup(int i) {
    List<String> userUIDList = new ArrayList<String>();
    userUIDList.add(Util.getUser().getUserUID());
    List<User> users = new ArrayList<>();
    users.add(Util.getUser());
    GroupTempInfo groupTempInfo = new GroupTempInfo(users, false);
    Group group = new Group(UUID.randomUUID().toString(), comment.getSubject().getSubjectUID(), i, Util.getServer().getTempInfo().getNumber(),
            groupTempInfo, "text", new ArrayList<Question>(), userUIDList,
            new ArrayList<Participation>(), false, comment);
    comment.setCommentGroup(group);
    Util.mServerDatabaseRef.child(Util.getServer().getType()).child(Util.getServer().getServerUID()).child("timeline").child("commentList").child(comment.getCommentUID()).child("commentGroup").setValue(group);
    sendNotification();
}

and this is my Structure on db firebase. I'm just trying to add an object to the "commmentList" db structure

I don't get any errors on compilation, just on the logcat Anyone has any ideia of what the problem is?

like image 904
ALEXANDRE CHAGAS VIEIRA JUNIOR Avatar asked Jan 03 '19 14:01

ALEXANDRE CHAGAS VIEIRA JUNIOR


2 Answers

This error happened to me when I tried to put Uri object in my database. I solved it by putting String representation of Uri instead.

like image 154
zeroDivider Avatar answered Nov 14 '22 07:11

zeroDivider


The reason of this error was that I was trying to set an object inside another object, where the first object had the first one and de first one had the second one:

a "Comment" had a "Group" as its attribute and "Group" had a "Comment" as its attribute

like image 21
ALEXANDRE CHAGAS VIEIRA JUNIOR Avatar answered Nov 14 '22 07:11

ALEXANDRE CHAGAS VIEIRA JUNIOR