Saved object returned with null content.
See original GitHub issueDBFlow Version: 4.0.0-beta5 Issue Kind (Bug, Question, Feature): Bug
Description: We are trying to save in DB a chat message object which contains different fields and two images with their byte code. Most of the time it is working fine but there are some situations, where the object saved successfully (save returns true) is later on returned “empty”, meaning that its variables are set to null.
private boolean saveValid(Chat chat) {
Log.d(Constants.TAG_ARCH, "ChatModel.saveValid: " + chat);
boolean success = chat.save();
Chat chat2 = SQLite.select().from(Chat.class).where(Chat_Table.firebaseKey.is(chat.getFirebaseKey())).querySingle();
Log.d(Constants.TAG, "ChatModel.saveValid: returned chat " + chat2);
return success;
}
This is the log received:
ChatModel.saveValid: ||Chat||com.madeinworld.android.common.chat.db.vo.Chat@361e303|PENDING_IMAGE|[-KiFhJ8YmMtzk9mG7EWI] pending =true, hasImage=true]
ChatModel.saveValid: returned chat ||Chat||com.madeinworld.android.common.chat.db.vo.Chat@b2ac280|MESSAGE_SENT|[null] pending =false, hasImage=false]null
This is how we handle chat image:
public byte[] getByteThumbnail() {
if(thumbnail == null){
return null;
}
return thumbnail.getBlob();
}
public void setByteThumbnail(byte[] byteThumbnail) {
this.thumbnail = new Blob(byteThumbnail);;
}
We are really not sure how or why the issue is happening.
For the moment there were two scenarios:
- Sending various images one ofter other, using different threads. Issue happens after 5th or 6th image
- Sending images from a specific folder from a phone gallery (e.g.:instagram folder)
Each case the images are shown correctly on GUI prior to sending so the byte code is correctly. Object should be correctly saved. Any help would be appreciated…
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:15 (7 by maintainers)
Top GitHub Comments
Hi guys !
I have exactly the same probleme using 4.2.4 :
object.save()
does save object (and sometimes does not save anything) with null content values. Do you have any clue please ?closing due to inactivity