Skip to content

RuntimeException is not catched in AsyncHttpClient.get() #208

@passos

Description

@passos

When try to call AsyncHttpClient.get() with a invalid url like "http://www.google.com abc", the below RuntimeException will cause appllication crash. I add a try statement to catch this and call responseHandler.sendFailureMessage to send back a error messge. This has been tested and works fine on my app.

Please take a look at my pull request, commit 7d502a8. #192

W/System.err(29085): java.lang.IllegalArgumentException: Illegal character in authority at index 22: http://www.google.com abc
W/System.err(29085):    at java.net.URI.create(URI.java:727)
W/System.err(29085):    at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:75)
W/System.err(29085):    at com.loopj.android.http.AsyncHttpClient.get(AsyncHttpClient.java:366)
W/System.err(29085):    at com.loopj.android.http.AsyncHttpClient.get(AsyncHttpClient.java:324)
W/System.err(29085):    at ...
W/System.err(29085):    at android.view.View.performClick(View.java:4202)
W/System.err(29085):    at android.view.View$PerformClick.run(View.java:17340)
W/System.err(29085):    at android.os.Handler.handleCallback(Handler.java:725)
W/System.err(29085):    at android.os.Handler.dispatchMessage(Handler.java:92)
W/System.err(29085):    at android.os.Looper.loop(Looper.java:137)
W/System.err(29085):    at android.app.ActivityThread.main(ActivityThread.java:5039)
W/System.err(29085):    at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(29085):    at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err(29085):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
W/System.err(29085):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
W/System.err(29085):    at dalvik.system.NativeStart.main(Native Method)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions