question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Saved object returned with null content.

See original GitHub issue

DBFlow 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:

  1. Sending various images one ofter other, using different threads. Issue happens after 5th or 6th image
  2. 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…

Chat.java.txt

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
mathieudebritocommented, Oct 10, 2018

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 ?

0reactions
agrosnercommented, Feb 16, 2021

closing due to inactivity

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to deal with null object being returned - Stack Overflow
How to deal with null object being returned ; try { model = await ; catch(NullReferenceException ex) { //Do something about it... }....
Read more >
NullReferenceException Class (System) - Microsoft Learn
NullReferenceException : Object reference // not set to an instance of an object. ... CurrentPage returns null if no page information is stored...
Read more >
null - JavaScript - MDN Web Docs - Mozilla
The null value represents the intentional absence of any object value. It is one of JavaScript's primitive values and is treated as falsy...
Read more >
c# - What's wrong with returning null?
No, if it suddenly can be null, you change the lowest function that might return null to return an optional, and the compiler...
Read more >
Read saved email to object return null Subject, Body and ...
Hi All, I am using Read saved email to object from UiPath connect to read contents from a .eml File. It returns a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found