Android Developer Console: Error Reports (IllegalCharsetNameException)

Kevin

Well-Known Member
Licensed User
Longtime User
Splitting out my questions on error reports into separate threads per Erel's request. Also Erel, if you think other might have similar questions I suppose you could consider a separate sub-forum for the sole purpose of others troubleshooting or interpreting these reports if you think it might be worth it.

(Original thread)


IllegalCharsetNameException: I'm not sure what to make of this as the only http responses my app should be getting are from DirecTV receivers. Possibly if they are in another country and the receiver names or show data use different character sets, but how or where would I check for this and display a message without crashing?
B4X:
 java.lang.RuntimeException: java.io.UnsupportedEncodingException: %s
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:145)
at anywheresoftware.b4a.BA$1.run(BA.java:210)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.io.UnsupportedEncodingException: %s
at java.io.InputStreamReader.<init>(InputStreamReader.java:89)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:130)
at anywheresoftware.b4a.http.HttpClientWrapper$HttpResponeWrapper.GetString(HttpClientWrapper.java:416)
at com.cognitial.directvremote.httputilsservice._hc_responseerror(httputilsservice.java:123)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:105)
... 10 more
Caused by: java.nio.charset.IllegalCharsetNameException: %s
at java.nio.charset.Charset.checkCharsetName(Charset.java:200)
at java.nio.charset.Charset.forName(Charset.java:290)
at java.io.InputStreamReader.<init>(InputStreamReader.java:85)
... 16 more
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You are probably receiving some gibberish message. The program fails while trying to read the error response. This is not really important as it is only logged.
This is the problematic code in HttpUtilsService.hc_ResponseError:
B4X:
   If Response <> Null Then
      Log(Response.GetString("UTF8"))
      Response.Release
   End If
You can change it to:
B4X:
If Response <> Null Then
      Try
         Log(Response.GetString("UTF8"))
      Catch
                        Log("Error decoding message.")
      End Try
      Response.Release
   End If
 
Upvote 0
Top