Skip to content

null and consequently crash on RetryHandler #137

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
elincognito opened this issue Nov 14, 2012 · 5 comments
Closed

null and consequently crash on RetryHandler #137

elincognito opened this issue Nov 14, 2012 · 5 comments
Assignees
Milestone

Comments

@elincognito
Copy link

in

if(retry) {
        // resend all idempotent requests
        HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute( ExecutionContext.HTTP_REQUEST );
        String requestType = currentReq.getMethod();
        retry = !requestType.equals("POST");
    }

currentReq returned is null and so the the currentReq.getMethod() crashs, leaving my application on a blocking state due to the fact that im waiting on the listeners to be invoked.
This happens for example if my Device is on Wi-Fi but with no internet connectivity

@emerson-zhang
Copy link

I have met the same problem. When the server is not running, a HttpHostConnectException occured. And the program goes into RetryHandler. The program was blocked at the same place as forcewill mentioned earlier.

I modified the code as below and resolved the problem. But I don't know whether is it correct.

if(retry) {
        // resend all idempotent requests
        HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute( ExecutionContext.HTTP_REQUEST );

        if(currentReq != null){
            String requestType = currentReq.getMethod();
            retry = !requestType.equals("POST");
        }
    }

@elincognito
Copy link
Author

That was exactly my fix and i don't know if it's correct also, it seems

     context.getAttribute( ExecutionContext.HTTP_REQUEST );

isn't supposed to return null ?

@changety
Copy link

meet the same problem as emerson-zhang's, too ,my program is also blocked by this problem

@wediagsa
Copy link

wediagsa commented Apr 3, 2013

same issue here, currentReq is null, therefore currentReq.getMethod() silently crashes...

@smarek
Copy link
Member

smarek commented Oct 14, 2013

Issue was partially modified in 6389fa9, I will commit in a moment full fix

@ghost ghost assigned smarek Oct 14, 2013
@smarek smarek closed this as completed in 89e0028 Oct 14, 2013
iNdieboyjeff pushed a commit to iNdieboyjeff/android-async-http that referenced this issue Oct 15, 2013
# By mareksebera (7) and Ankush Sachdeva (1)
# Via Ankush Sachdeva (1) and Marek Sebera (1)
* 'master' of https://github.com/loopj/android-async-http:
  Added Proxy Authentication ; fixes android-async-http#328
  Fixed wrong static field, Closing android-async-http#229
  Manual merge, Closing android-async-http#269, android-async-http#118, Closing android-async-http#10, Closing android-async-http#127, android-async-http#154
  Closes android-async-http#137
  Removing duplicate call
  Closing android-async-http#179
  Updated Gradle Android tools version
  Cleaning up error message output
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

5 participants