nextcloud / notes-android

✎ Android client for Nextcloud Notes app.
https://play.google.com/store/apps/details?id=it.niedermann.owncloud.notes
GNU General Public License v3.0
932 stars 135 forks source link

Exception -> IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY #2238

Open pawlosck opened 3 months ago

pawlosck commented 3 months ago

This issue respects the following points:

Describe the bug

  1. Touch widget (single note) to open app.
  2. App should open specified note, but open new note -> It's first bug, but its related bug
  3. Press twice Back button (first close keyboard, second switch app to list of notes) - Exception sometimes is not visible. You should close all app and start again
  4. If you can't reproduce it, try remove note from android app
  5. App show exception when trying to sync

If I remember well, it happen when I copied some text from website to notes app (web app). Copied text was converted to table. After that, notes app (android) show exception and specified note from widget can't be opened.

I tried to fix it, but it doesn't work. I removed app from server, renamed Notes dir and cleared storage for notes app (android). I installed app on the server and logged in on the android (notes app) After installation was ok, but there wasn't any note. When I copied old notes to new dir, app started show the same exception.

I suppose, problem is located on the server. Probably some text was incorrectly stored into database. How to clear all settings related to notes app? Maybe it fix it. I am using sqlite database.

Expected behavior

App should open specified note and sync without errors

Notes Android version

4.2.1

Notes server version

4.10

Nextcloud Android version

3.29

Nextcloud version

28.0.3

Device

Samsung Galaxy S24

Android Version

14

App Store

Stacktrace

App Version: 4.2.1
App Version Code: 40020190
App Flavor: fdroid

Files App Version Code: 30290090 (PROD)

---

OS Version: 6.1.25-android14-11-28243294-abS928BXXS2AXD6(S928BXXS2AXD6)
OS API Level: 34
Device: e3q
Manufacturer: samsung
Model (and Product): SM-S928B (e3qxeea)

---

java.lang.Exception: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
    at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pushLocalChanges(NotesServerSyncTask.java:174)
    at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:94)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
    at java.lang.Thread.run(Thread.java:1012)
stefan-niedermann commented 3 months ago

Given the stacktrace seems to be similar, maybe this might help?

pawlosck commented 3 months ago

It's different problem. I disabled mail app (it's official app probably), restarted phone and restarted apache. Exception don't want to go away :(.

EDIT: I don't use Rainloop, Snappymail and other mail app with nextcloud

bigrjsuto commented 3 months ago

Looks like I'm getting the same error on my phone and tablet:

App Version: 4.2.1
App Version Code: 40020190
App Flavor: fdroid

Files App Version Code: 30290090 (PROD)

---

OS Version: 4.19.113-27114284(T878USQS8DXE1)
OS API Level: 33
Device: gts7l
Manufacturer: samsung
Model (and Product): SM-T878U (gts7lsqwnc)

---

java.lang.Exception: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
    at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pushLocalChanges(NotesServerSyncTask.java:174)
    at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:94)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
    at java.lang.Thread.run(Thread.java:1012)
App Version: 4.2.1
App Version Code: 40020190
App Flavor: fdroid

Files App Version Code: 30290090 (PROD)

---

OS Version: 4.14.340-perf-g065a3bb48b97(138)
OS API Level: 34
Device: OnePlus7Pro
Manufacturer: OnePlus
Model (and Product): GM1911 (OnePlus7Pro)

---

java.lang.Exception: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
    at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pushLocalChanges(NotesServerSyncTask.java:174)
    at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:94)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
    at java.lang.Thread.run(Thread.java:1012)