MythTV-Clients / MythtvPlayerForAndroid

MythTV Player is an Android client for accessing content from a MythTV Backend
https://play.google.com/store/apps/details?id=org.mythtv.android
GNU General Public License v3.0
16 stars 7 forks source link

Failure to connect diagnosis #231

Closed billmeek closed 7 years ago

billmeek commented 7 years ago

Comments (some nasty) of the app say that if the app can't connect to the backend, there's no way to tell what's wrong.

Would a solution be to check the individual parts of the connection, e.g.

dmfrey commented 7 years ago

you mean pop a dialog with this information? Sure, sounds like a good idea.

On Fri, Jan 20, 2017 at 9:16 PM billmeek notifications@github.com wrote:

Assigned #231 https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/231 to @dmfrey https://github.com/dmfrey.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/231#event-931546664, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5yzIvGm5FpwnJsAwwAmKvLUPnF0U3xks5rUWpegaJpZM4Lp7Y1 .

billmeek commented 7 years ago

I found this for the device itself: https://developer.android.com/training/monitoring-device-state/connectivity-monitoring.html

There seems to be a ping in /system: http://stackoverflow.com/questions/3905358/how-to-ping-external-ip-from-java-android

I use nmap -p 6544 backendName to see if the port is even there (from the shell.)

I was think along the lines of a verbose description of any failure, e.g.

Please turn on your Wi-Fi on this device.

or

Unable to connect to the backend, see if it's running and/or check the backend logs. A simple test is to access the backend Services API from a browser on this device. Try:

IP/hostFromSettings:6544/Myth/GetHostName

etc.

dmfrey commented 7 years ago

that's a good idea. let's outline the scenarios. Does each warrant a separate issue? I will probably have to come up with some more specific exceptions to capture these cases, so that we can trigger the specific messages in the UI.

On Fri, Jan 20, 2017 at 9:50 PM billmeek notifications@github.com wrote:

I found this for the device itself:

https://developer.android.com/training/monitoring-device-state/connectivity-monitoring.html

There seems to be a ping in /system:

http://stackoverflow.com/questions/3905358/how-to-ping-external-ip-from-java-android

I use nmap -p 6544 backendName to see if the port is even there (from the shell.)

I was think along the lines of a verbose description of any failure, e.g.

Please turn on your Wi-Fi on this device.

or

Unable to connect to the backend, see if it's running and/or check the backend logs. A simple test is to access the backend Services API from a browser on this device. Try:

IP/hostFromSettings:6544/Myth/GetHostName

etc.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/231#issuecomment-274228246, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5yzJ58TpejQ1dfrqyPRv4xYKdXiYeoks5rUXJsgaJpZM4Lp7Y1 .

dmfrey commented 7 years ago

The app is already doing network connectivity checks. Take a look at this code. It is being done in a few places and I should really clean that up so there is only ever a single instance of this code.

isThereInternetConnection()

dmfrey commented 7 years ago

@billmeek I am not sure a ping is needed, so long as we react to connection failures appropriately. The SnackBar can contain an OnClickHandler. So maybe we make the network connection SnackBar contain a Troubleshoot link that lets us call all of these on one screen. So we could list the result of the ping on one line, along with the test name and a red or green dot to show if it passed or not. We could call the /Myth/GetHostName and display it in the same way.

We could use this as a common place to display all these tests.

billmeek commented 7 years ago

Simple version of what follows:

Found ICMP on this page, may help: https://developer.android.com/reference/java/net/InetAddress.html#isReachable(int) I like ICMP (ping) because it's just testing to see if the host is there. No port required. It wouldn't need to be done all the time, just when troubleshooting (e.g keep the existing isThereInternetConnection() and just drill down if required.) I'm thinking isThereInternetConnection is testing the phone/tablet's access to Wi-Fi.

Things like firewalls/port filtering may be in the way. The address could appear in the SnackBar for all diagnostics. Ideally, the host name if used in settings and always the IP, which could be IPv4 or 6.

I really like the idea of a Troubleshoot link.

Something like: if isThereInternetConnection() fails and Troubleshoot is selected, then do the sReachable() followed by Myth/GetHostName to verify that the Sevices API is fully available.

dmfrey commented 7 years ago

@billmeek checkout the branch feature/issue_231_connectivity_check and give it a look. You can access the troubleshooter from the navigation drawer, the overflow menu on a video or recording, or anytime a SnackBar shows a connection failure. I think it still needs a little cleanup, but I think it is in line with what you were thinking.

billmeek commented 7 years ago

Looking good! Recording right now, so only tested the 1st 2, plus I mangled the hostname and that fails as expected.

dmfrey commented 7 years ago

@billmeek should we also add checks that we can parse recordings, upcoming recordings, encoders and videos?

billmeek commented 7 years ago

That could be good, not a connection problem, but a configuration one.

One user had: LANG="en_US.ISO-8859-1" rather than en_US.UTF-8 (actually, it was German) that caused a parser to fail.

There's another way to test LANG: http://mc0:6544/Myth/GetBackendInfo once JSON parsing is known to be OK.

<BackendInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" serializerVersion="1.1">
<Build>
<Version>v29-pre-194-g2a1ccc0</Version>
<LibX264>true</LibX264>
<LibDNS_SD>true</LibDNS_SD>
</Build>
<Env>
<LANG>en_US.UTF-8</LANG>
<LCALL>en_US.UTF-8</LCALL>
<LCCTYPE>en_US.UTF-8</LCCTYPE>
<HOME>/home/mythtv</HOME>
<MYTHCONFDIR/>
</Env>
<Log>
<LogArgs>
--verbose general --logpath /var/log/mythtv --loglevel info --quiet
</LogArgs>
</Log>
</BackendInfo>

I should retest that in 3.0.1. (recording right now, again.)

dmfrey commented 7 years ago

i should probably add a check in here for minimum mythtv version too. Thought?

billmeek commented 7 years ago

The version test makes sense to me. And it works with v29-pre.

The text on the Troublesheeo Connection page that reads: "Airplane Mode is on" should be off. I'll push that (the icon is correct.)

dmfrey commented 7 years ago

Cool. Anything more with this. I was thinking about the tests to parse the json for recordings, upcoming, videos and encoders. We should be handling all the parsing errors with #68 so I don't think we will need to put that here. We should probably keep it to 1 screen.

billmeek commented 7 years ago

I like the existing screen, all the tests fit on a single page of my Nexus 7.

Maybe all the text should just say what the test is doing and let the icon reflect the state. I know that if I enter the Airplane mode now, the text doesn't change. Are you OK with letting the icons tell the story?

dmfrey commented 7 years ago

Yes, that should be fine. Feel free to reword them. Keep them short enough to fit on one line.

dmfrey commented 7 years ago

just got the updates. gonna merge this into develop unless there are other outstanding requests

billmeek commented 7 years ago

I do have some changes to the text, but won't be able to get to it 'til later today.

dmfrey commented 7 years ago

ok, let me know when you get them in and I will merge the PR

On Tue, Jan 24, 2017 at 12:55 PM billmeek notifications@github.com wrote:

I do have some changes to the text, but won't be able to get to it 'til later today.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/231#issuecomment-274882695, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5yzJEDjd7XgXbW42QKpiqBhn8eUOz6ks5rVjsAgaJpZM4Lp7Y1 .

billmeek commented 7 years ago

With troubleshooting, the app gets a fatal exception when it tries to use GetBackendInfo for a version that doesn't have the GetBackendInfo endpoint (< 0.28.)

curl -H Accept:"application/json" mc4:2744/Myth/GetBackendInfo
<?xml version="1.0" encoding="utf-8"?><detail><errorCode>401</errorCode><errorDescription>Invalid Action</errorDescription></detail>

Sent the above to my 0.27 backend (that's why the port above is 2744.)

From LogCat when the app does it:

01-24 20:01:28.090 24202-24377/org.mythtv.android D/OkHttp: <-- 404 Not Found http://192.168.1.224:2744/Myth/GetBackendInfo (47ms)
01-24 20:01:28.090 24202-24377/org.mythtv.android D/OkHttp: Date: 25 Jan 2017 02:01:30
01-24 20:01:28.090 24202-24377/org.mythtv.android D/OkHttp: Server: Linux 4.4.0-31-generic, UPnP/1.0, MythTV 0.27.20151025-1
01-24 20:01:28.090 24202-24377/org.mythtv.android D/OkHttp: Accept-Ranges: bytes
01-24 20:01:28.090 24202-24377/org.mythtv.android D/OkHttp: Connection: Keep-Alive
01-24 20:01:28.091 24202-24377/org.mythtv.android D/OkHttp: Content-Type: text/html; charset="UTF-8"
01-24 20:01:28.091 24202-24377/org.mythtv.android D/OkHttp: <-- END HTTP
01-24 20:01:28.092 24202-24377/org.mythtv.android D/TroubleshootActivity: doInBackground : result=okhttp3.ResponseBody$BomAwareReader@e73b3b3
01-24 20:01:28.101 24202-24377/org.mythtv.android E/UncaughtException: java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                                           at android.os.AsyncTask$3.done(AsyncTask.java:309)
                                                                           at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
                                                                           at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
                                                                           at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                           at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
                                                                           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                           at java.lang.Thread.run(Thread.java:818)
                                                                        Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $
                                                                           at com.google.gson.JsonParser.parse(JsonParser.java:65)
                                                                           at org.mythtv.android.data.entity.mapper.BackendVersionJsonMapper.transformString(BackendVersionJsonMapper.java:50)
                                                                           at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:503)
                                                                           at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:485)
                                                                           at android.os.AsyncTask$2.call(AsyncTask.java:295)
                                                                           at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                           at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
                                                                           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                                                                           at java.lang.Thread.run(Thread.java:818) 
                                                                        Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $
                                                                           at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559)
                                                                           at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401)
                                                                           at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542)
                                                                           at com.google.gson.stream.JsonReader.peek(JsonReader.java:425)
                                                                           at com.google.gson.JsonParser.parse(JsonParser.java:60)
                                                                           at org.mythtv.android.data.entity.mapper.BackendVersionJsonMapper.transformString(BackendVersionJsonMapper.java:50) 
                                                                           at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:503) 
                                                                           at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:485) 
                                                                           at android.os.AsyncTask$2.call(AsyncTask.java:295) 
                                                                           at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
                                                                           at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
                                                                           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                                                                           at java.lang.Thread.run(Thread.java:818) 
01-24 20:01:28.117 24202-24294/org.mythtv.android D/FA: Event not sent since app measurement is disabled
01-24 20:01:28.150 24202-24208/org.mythtv.android W/art: Suspending all threads took: 6.652ms

                                                         --------- beginning of crash
01-24 20:01:28.432 24202-24377/org.mythtv.android E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #5
                                                                    Process: org.mythtv.android, PID: 24202
                                                                    java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                                        at android.os.AsyncTask$3.done(AsyncTask.java:309)
                                                                        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
                                                                        at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                        at java.lang.Thread.run(Thread.java:818)
                                                                     Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $
                                                                        at com.google.gson.JsonParser.parse(JsonParser.java:65)
                                                                        at org.mythtv.android.data.entity.mapper.BackendVersionJsonMapper.transformString(BackendVersionJsonMapper.java:50)
                                                                        at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:503)
                                                                        at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:485)
                                                                        at android.os.AsyncTask$2.call(AsyncTask.java:295)
                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                                                                        at java.lang.Thread.run(Thread.java:818) 
                                                                     Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $
                                                                        at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559)
                                                                        at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401)
                                                                        at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542)
                                                                        at com.google.gson.stream.JsonReader.peek(JsonReader.java:425)
                                                                        at com.google.gson.JsonParser.parse(JsonParser.java:60)
                                                                        at org.mythtv.android.data.entity.mapper.BackendVersionJsonMapper.transformString(BackendVersionJsonMapper.java:50) 
                                                                        at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:503) 
                                                                        at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:485) 
                                                                        at android.os.AsyncTask$2.call(AsyncTask.java:295) 
                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
                                                                        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
dmfrey commented 7 years ago

Can you post the JSON for GetBackendInfo from v0.27? I'm guessing it's a mapping issue.

On Tue, Jan 24, 2017, 9:07 PM billmeek notifications@github.com wrote:

With troubleshooting, the app gets a fatal exception when it tries to use GetBackendInfo for a version that doesn't have the GetBackendInfo endpoint (< 0.28.)

curl -H Accept:"application/json" mc4:2744/Myth/GetBackendInfo <?xml version="1.0" encoding="utf-8"?>401Invalid Action

Sent the above to my 0.27 backend (that's why the port above is 2744.)

From LogCat when the app does it:

01-24 20:01:28.090 24202-24377/org.mythtv.android D/OkHttp: <-- 404 Not Found http://192.168.1.224:2744/Myth/GetBackendInfo (47ms) 01-24 20:01:28.090 24202-24377/org.mythtv.android D/OkHttp: Date: 25 Jan 2017 02:01:30 01-24 20:01:28.090 24202-24377/org.mythtv.android D/OkHttp: Server: Linux 4.4.0-31-generic, UPnP/1.0, MythTV 0.27.20151025-1 01-24 20:01:28.090 24202-24377/org.mythtv.android D/OkHttp: Accept-Ranges: bytes 01-24 20:01:28.090 24202-24377/org.mythtv.android D/OkHttp: Connection: Keep-Alive 01-24 20:01:28.091 24202-24377/org.mythtv.android D/OkHttp: Content-Type: text/html; charset="UTF-8" 01-24 20:01:28.091 24202-24377/org.mythtv.android D/OkHttp: <-- END HTTP 01-24 20:01:28.092 24202-24377/org.mythtv.android D/TroubleshootActivity: doInBackground : result=okhttp3.ResponseBody$BomAwareReader@e73b3b3 01-24 20:01:28.101 24202-24377/org.mythtv.android E/UncaughtException: java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $ at com.google.gson.JsonParser.parse(JsonParser.java:65) at org.mythtv.android.data.entity.mapper.BackendVersionJsonMapper.transformString(BackendVersionJsonMapper.java:50) at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:503) at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:485) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $ at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542) at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) at com.google.gson.JsonParser.parse(JsonParser.java:60) at org.mythtv.android.data.entity.mapper.BackendVersionJsonMapper.transformString(BackendVersionJsonMapper.java:50) at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:503) at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:485) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) 01-24 20:01:28.117 24202-24294/org.mythtv.android D/FA: Event not sent since app measurement is disabled 01-24 20:01:28.150 24202-24208/org.mythtv.android W/art: Suspending all threads took: 6.652ms

                                                     --------- beginning of crash

01-24 20:01:28.432 24202-24377/org.mythtv.android E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #5 Process: org.mythtv.android, PID: 24202 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $ at com.google.gson.JsonParser.parse(JsonParser.java:65) at org.mythtv.android.data.entity.mapper.BackendVersionJsonMapper.transformString(BackendVersionJsonMapper.java:50) at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:503) at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:485) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $ at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542) at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) at com.google.gson.JsonParser.parse(JsonParser.java:60) at org.mythtv.android.data.entity.mapper.BackendVersionJsonMapper.transformString(BackendVersionJsonMapper.java:50) at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:503) at org.mythtv.android.presentation.view.activity.phone.TroubleshootActivity$BackendVersionVerificationAsyncTask.doInBackground(TroubleshootActivity.java:485) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/MythTV-Clients/MythtvPlayerForAndroid/issues/231#issuecomment-274999362, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5yzNwXvo-slK9WAfm9W0T3B43Ol_l3ks5rVq51gaJpZM4Lp7Y1 .

billmeek commented 7 years ago

Unfortunately, it's an old MythTV issue. When the error fires, the response is in XML, even though curl -H Accept:"application/json" mc4:2744/Myth/GetBackendInfo was sent. If that endpoint existed in 0.27, then the response would have been in json.

billmeek commented 7 years ago

@dmfrey, just pushed some new text. All remain on a single line on my tablet in both landscape and portrait modes.

dmfrey commented 7 years ago

Reopening to address where /Myth/GetBackendInfo does not exist, but returns XML instead of JSON

billmeek commented 7 years ago

@dmfrey, I could open a new issue if you like. Rather than this specific case, a generic case for XML coming back when JSON is requested. I haven't found the MythTV ticket yet, but do remember reading one. Out of my league and would only be fixed in master since it could affect existing API clients in my opinion.

dmfrey commented 7 years ago

Na, after looking at the stacktrace you posted, it looks like all I needed was another exception handler. Can you test it again with the latest commit?

billmeek commented 7 years ago

That looks like the fix. Now the Troubleshooter correctly fails because the backend isn't 0.28 or later. The UTF-8 check remains gray, because that test isn't reached, which is good.

All of the tests have been tested. The last one was LANG="en_US.ISO-8859-1" in the backend and the UTF-8 test failed, as it should.

Closing.