Azure Mobile table for Android throws UnsupportedOperationException RRS feed

  • Question

  • Hi,

    I have the following big issue with Azure Mobile tables for Android. If during the push something goes wrong (e.g. just quit the app in the debugger during pushing) the database is left in a state which is not recoverable during the next initialization of the local store.

    The issue is in OperationErrorList::deserialize()
    String serverResponse = element.get("serverresponse") != null ? element.get("serverresponse").getAsString() : null;

    The element is not a null value but  a JsonNull value. And calling getAsString() on a JsonNull leads to an UnsupportedOperationException. It's really bad, because from this point on the offline store is not usable which is very serious.


    Friday, July 1, 2016 8:33 AM

All replies

  • Hello,

    Thank you for posting here!

    I would suggest you to use JsonParser().parse(); with getAsString(). You can refer “How to: Store an object or array property into a table  section with “Customizing serialization using the json” document from this article to do the same.

    Hope this help.



    If a post answers your question, please click Mark as Answer on that post and Vote as Helpful.
    • Proposed as answer by Swikruti Bose Saturday, July 2, 2016 3:02 PM
    Friday, July 1, 2016 4:31 PM
  • Quitting the app in the middle of a database operation is not supported, and can definitely to an database invalid state as you noted. If you plan to do this during app development, then you should delete the local database file or use a different filename on your next launch.  Alternatively, you could wait for control to return to user code before quitting.

    This is similar to how a file would be partially written if you interrupted the operation, and the resulting file would not be in a valid format.

    • Proposed as answer by Swikruti Bose Saturday, July 2, 2016 3:02 PM
    • Unproposed as answer by MonRoyals Wednesday, July 6, 2016 11:05 AM
    Friday, July 1, 2016 10:55 PM
  • Hell Donna,

    thanks for your reply. I'm a little bit afraid that my database is locked in an invalid state. If I have potentially millions of clients I'm afraid that at some point the database becomes invalid and than my whole app is useless and is not recoverabale. The app could crash for some reason or the phone runs out of battery or I don't know what everything can happen that kills the app. And I don't know if any other operation can lead to an invalid state.

    I don't see any solution to catch such an error and to rescue the data. Can this happen under different circumstances? If yes, than I have to switch to another solution without the offline tables. The database is not corrupt, it only has some errors defined in one table (which can't be deleted).

    During development I had a lot of situations where the only solution was to switch to a fresh database. That's not really a trustworthy situation for me to use your solution. Have you made similar experiences also for databases in production?

    What I didn't understand is, that in the code fragment I posted, you are checking for a "null" value. So you are handling such cases, that there is no response. From my perspective it looks like a bug, that "null" is ok but not a JsonNull object.


    • Edited by MonRoyals Sunday, July 3, 2016 4:56 PM
    Sunday, July 3, 2016 4:41 PM
  • Any update on this topic?

    By the way, is the development still in progress or active for Azure Mobile Service? One issue ( I added a month ago is not even assigned. 

    • Edited by MonRoyals Friday, July 29, 2016 11:14 AM another question added
    Friday, July 29, 2016 11:09 AM