Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 457492

Summary: [server] WARNING: Going to buffer response body of large or unknown size.
Product: [ECD] Orion Reporter: Anthony Hunter <ahunter.eclipse>
Component: ServerAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 8.0   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Anthony Hunter CLA 2015-01-14 15:19:17 EST
As we expand our cloudfoundy support, there are an increasing number of warnings being thrown and filling up the log:

WARNING: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
Jan 14, 2015 2:50:35 PM org.apache.commons.httpclient.HttpMethodBase getResponseBody

These are being output as a result of our usage of HttpMethod.getResponseBodyAsString()

A number of the responses from remote servers are being returned without a Content-Length header. As a result, the warning recommends not to use this API due to possible memory overflows since the entire buffer is loaded in memory.

Simon pointed out that we can simply take advantage of 
HttpMethodBase.getResponseBodyAsString(int limit) and provide a limit of 64MB (67108864). We assume that no server response is going to be greater than this size and we prevent the memory overflow.

I have done some limited testing and it successfully resolves these warnings.