« Back to Cius Developer Questions

Problem with HttpClient in latest firmware 9.2(3)

Combination View Flat View Tree View
Threads [ Previous | Next ]
I've encountered an issue in my app in the latest firmware. Previous releases worked without issue. The relevant code is: 
 


HttpResponse response = httpClient.execute(request, localContext);
 
// currentReq is assigned null
HttpUriRequest currentReq = (HttpUriRequest) getLocalContext().getAttribute(ExecutionContext.HTTP_REQUEST);
 
// currentHost is assigned properly as always
HttpHost currentHost = (HttpHost)  getLocalContext().getAttribute(ExecutionContext.HTTP_TARGET_HOST);
 
I checked the Android API as well as stock HttpClient documentation and this should work. I can attempt to work around it, but wondered if anyone else has run into this with the latest firmware?
 

Hello David,

Can you please let us know what application you are facing an issue with?

Thank you,
Prem

Can you tell us the nature of the failure (stack trace?)  Do you see anything in logcat?  We have not heard of any issues heretofore but 9.2.3 was just released.

Can you tell us the nature of the failure (stack trace?)  Do you see anything in logcat?  We have not heard of any issues heretofore but 9.2.3 was just released.

 
The app is called MobileMiner. It's in AppHQ. I submitted a new version this morning with a workaround, but the version that is still available at this point (2.09) will exhibit this error. I haven't had reports from anyone using it on any other Android device, although the installed base is rather small. 
 
I get a NPE because I try to invoke a method on the HttpUriRequest object that I expect to be returned by HttpContext, but in fact I get a null pointer instead of the HttpUriRequest object. Basically, what I'm doing is creating a request, executing it, then attempting to retrieve the final URI used in the request after I get the response so that I properly follow redirects. The documentation for doing so does it exactly how I'm doing it, and it worked in all previous firmware versions, so I'm wondering if there might be an issue with the latest firmware's implementation of HttpClient. Here's the relevant documentation: 
 
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/httpagent.html#d5e1255

The method call to retrieve the actual host works, so in my hacked version I just parse the original URL from the request to get the relative portion of the URI and append it to the host portion of the URI. This works for probably most cases for my app, but it by no means is the right way to do it as a redirect could change the relative path along with the host. 

Looks like this is a change in behaviour and likely a defect.  Opened defect # CSCty84170 for tracking.

This issue looks to be resolved in the 9.2.4 release - targeted for 'middle of May' 2012