Skip to content

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

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

Closed
passos opened this issue Apr 12, 2013 · 1 comment
Closed

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

passos opened this issue Apr 12, 2013 · 1 comment

Comments

@passos
Copy link

passos commented Apr 12, 2013

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)
@smarek
Copy link
Member

smarek commented Oct 14, 2013

Closing, as the pull request was merged.

@smarek smarek closed this as completed Oct 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants