Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONException: No value for Invalid #291

Closed
Zillode opened this issue Mar 23, 2015 · 14 comments
Closed

JSONException: No value for Invalid #291

Zillode opened this issue Mar 23, 2015 · 14 comments

Comments

@Zillode
Copy link
Contributor

Zillode commented Mar 23, 2015

Not sure?

W/RestApi ( 2224): Failed to read devices
W/RestApi ( 2224): org.json.JSONException: No value for Invalid
W/RestApi ( 2224):  at org.json.JSONObject.get(JSONObject.java:389)
W/RestApi ( 2224):  at org.json.JSONObject.getString(JSONObject.java:550)
W/RestApi ( 2224):  at com.nutomic.syncthingandroid.syncthing.RestApi.getFolders(RestApi.java:484)
W/RestApi ( 2224):  at com.nutomic.syncthingandroid.fragments.FoldersFragment.initAdapter(FoldersFragment.java:60)
W/RestApi ( 2224):  at com.nutomic.syncthingandroid.fragments.FoldersFragment.onApiChange(FoldersFragment.java:43)
W/RestApi ( 2224):  at com.nutomic.syncthingandroid.syncthing.SyncthingService.onApiChange(SyncthingService.java:400)
W/RestApi ( 2224):  at com.nutomic.syncthingandroid.syncthing.SyncthingService.access$500(SyncthingService.java:42)
W/RestApi ( 2224):  at com.nutomic.syncthingandroid.syncthing.SyncthingService$PollWebGuiAvailableTaskImpl.onPostExecute(SyncthingService.java:382)
W/RestApi ( 2224):  at com.nutomic.syncthingandroid.syncthing.SyncthingService$PollWebGuiAvailableTaskImpl.onPostExecute(SyncthingService.java:370)
W/RestApi ( 2224):  at android.os.AsyncTask.finish(AsyncTask.java:632)
W/RestApi ( 2224):  at android.os.AsyncTask.access$600(AsyncTask.java:177)
W/RestApi ( 2224):  at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
W/RestApi ( 2224):  at android.os.Handler.dispatchMessage(Handler.java:102)
W/RestApi ( 2224):  at android.os.Looper.loop(Looper.java:135)
W/RestApi ( 2224):  at android.app.ActivityThread.main(ActivityThread.java:5221)
W/RestApi ( 2224):  at java.lang.reflect.Method.invoke(Native Method)
W/RestApi ( 2224):  at java.lang.reflect.Method.invoke(Method.java:372)
W/RestApi ( 2224):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
W/RestApi ( 2224):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
I/RestApi ( 2224): Syncthing version is v0.10.26
@Zillode Zillode added the bug label Mar 23, 2015
@Nutomic
Copy link
Contributor

Nutomic commented Mar 23, 2015

The value for the json key "Invalid" is null for some reason. Looks like an upstream problem of some kind.

@AudriusButkevicius
Copy link
Member

I dont think that it omits empty values, though perhaps the answer was something else than the config, hence it wasn't present at all? But then you wouldn't be able to traverse all the way down to the invalid key.

@Zillode
Copy link
Contributor Author

Zillode commented Mar 24, 2015

W/GetTask (14068):  ... 19 more
D/AndroidRuntime(14068): Shutting down VM
W/GetTask (14068): Failed to call Rest API at http://127.0.0.1:8080/rest/config
W/GetTask (14068): org.apache.http.conn.HttpHostConnectException: Connection to http://127.0.0.1:8080 refused
W/GetTask (14068):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)
W/GetTask (14068):  at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
W/GetTask (14068):  at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
W/GetTask (14068):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
W/GetTask (14068):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
W/GetTask (14068):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
W/GetTask (14068):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
W/GetTask (14068):  at com.nutomic.syncthingandroid.syncthing.GetTask.doInBackground(GetTask.java:63)
W/GetTask (14068):  at com.nutomic.syncthingandroid.syncthing.GetTask.doInBackground(GetTask.java:27)
W/GetTask (14068):  at android.os.AsyncTask$2.call(AsyncTask.java:288)
W/GetTask (14068):  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/GetTask (14068):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
W/GetTask (14068):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/GetTask (14068):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/GetTask (14068):  at java.lang.Thread.run(Thread.java:811)
W/GetTask (14068): Caused by: java.net.ConnectException: failed to connect to /127.0.0.1 (port 8080): connect failed: ECONNREFUSED (Connection refused)
W/GetTask (14068):  at libcore.io.IoBridge.connect(IoBridge.java:114)
W/GetTask (14068):  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
W/GetTask (14068):  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:460)
W/GetTask (14068):  at java.net.Socket.connect(Socket.java:833)
W/GetTask (14068):  at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
W/GetTask (14068):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
W/GetTask (14068):  ... 14 more
W/GetTask (14068): Caused by: libcore.io.ErrnoException: connect failed: ECONNREFUSED (Connection refused)
W/GetTask (14068):  at libcore.io.Posix.connect(Native Method)
W/GetTask (14068):  at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85)
W/GetTask (14068):  at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
W/GetTask (14068):  at libcore.io.IoBridge.connect(IoBridge.java:112)
W/GetTask (14068):  ... 19 more
E/AndroidRuntime(14068): FATAL EXCEPTION: main
E/AndroidRuntime(14068): Process: com.nutomic.syncthingandroid, PID: 14068
E/AndroidRuntime(14068): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
E/AndroidRuntime(14068):    at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)
E/AndroidRuntime(14068):    at org.json.JSONTokener.nextValue(JSONTokener.java:94)
E/AndroidRuntime(14068):    at org.json.JSONObject.<init>(JSONObject.java:155)
E/AndroidRuntime(14068):    at org.json.JSONObject.<init>(JSONObject.java:172)
E/AndroidRuntime(14068):    at com.nutomic.syncthingandroid.syncthing.RestApi$1.onPostExecute(RestApi.java:208)
E/AndroidRuntime(14068):    at com.nutomic.syncthingandroid.syncthing.RestApi$1.onPostExecute(RestApi.java:204)
E/AndroidRuntime(14068):    at android.os.AsyncTask.finish(AsyncTask.java:632)
E/AndroidRuntime(14068):    at android.os.AsyncTask.access$600(AsyncTask.java:177)
E/AndroidRuntime(14068):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
E/AndroidRuntime(14068):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(14068):    at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(14068):    at android.app.ActivityThread.main(ActivityThread.java:5139)
E/AndroidRuntime(14068):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(14068):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
E/AndroidRuntime(14068):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)

@Zillode
Copy link
Contributor Author

Zillode commented Mar 24, 2015

java.lang.NullPointerException
at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)
at org.json.JSONTokener.nextValue(JSONTokener.java:94)
at org.json.JSONObject.<init>(JSONObject.java:154)
at org.json.JSONObject.<init>(JSONObject.java:171)
at com.nutomic.syncthingandroid.syncthing.RestApi$11.onPostExecute(RestApi.java:880)
at com.nutomic.syncthingandroid.syncthing.RestApi$11.onPostExecute(RestApi.java:873)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4947)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(Native Method)

Zillode added a commit to Zillode/syncthing-android that referenced this issue Mar 28, 2015
Zillode added a commit to Zillode/syncthing-android that referenced this issue Mar 29, 2015
@Zillode
Copy link
Contributor Author

Zillode commented Apr 5, 2015

This is a very frequent problem based on logs from the play store:/

@Zillode Zillode closed this as completed in e317b11 May 6, 2015
@Zillode
Copy link
Contributor Author

Zillode commented May 23, 2015

I tracked all upstream paths but could not see a pattern which would lead to a missing 'invalid' field. Therefore

r.invalid = json.getString("invalid"); // TODO Upstream bug
should be analyzed further and have a reproducing test.

@Zillode Zillode reopened this May 23, 2015
@Nutomic
Copy link
Contributor

Nutomic commented May 23, 2015

It would help to find out under what circumstances this happens. I just tried some things and couldn't reproduce.

Maybe it was fixed upstream in the meantime?

@Zillode
Copy link
Contributor Author

Zillode commented May 23, 2015

No nothing changed in that regard. If we disable this fix, it will trigger this bug very infrequently.

@lkwg82
Copy link
Contributor

lkwg82 commented Apr 10, 2016

Is this still relevant?

@Zillode
Copy link
Contributor Author

Zillode commented Apr 10, 2016

It is, with daily crashes on the play store dashboard.

@lkwg82
Copy link
Contributor

lkwg82 commented Apr 10, 2016

Do you have an indication if it is specific to a version of android or syncthing or syncthing-android?

@Zillode
Copy link
Contributor Author

Zillode commented Apr 10, 2016

jsonexception

@Nutomic
Copy link
Contributor

Nutomic commented Oct 31, 2016

Not relevant any more, ecause Gson ignores missing keys.

@Nutomic Nutomic closed this as completed Oct 31, 2016
@syncthing syncthing locked and limited conversation to collaborators Nov 9, 2018
acolomb pushed a commit to acolomb/syncthing-android that referenced this issue Nov 12, 2023
* Fix crash notification reason is off-screen (fixes syncthing#294)

* Indicate a broken config on the welcome wizard (fixes syncthing#293)

* SyncthingService must stop if the config got corrupted (fixes syncthing#292)

* Show crash notification extraInfo below notification title (fixes syncthing#294)

* Fix NPE when config elements gui, options are missing (fixes syncthing#291)

* Updated de translation

* Update en translation

* Updated translations

* Remove debug log
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants