Bug 58544

Summary: RequestDumperFilter contentLength inefficiently creating Integer
Product: Tomcat 8 Reporter: Anthony Whitford <anthony>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: trivial    
Priority: P2    
Version: 8.0.x-trunk   
Target Milestone: ----   
Hardware: Macintosh   
OS: Mac OS X 10.1   
Attachments: Corrects contentLength logging to use less resources

Description Anthony Whitford 2015-10-25 22:43:35 UTC
Created attachment 33216 [details]
Corrects contentLength logging to use less resources

The contentLength logging in RequestDumperFilter is calling:

    Integer.valueOf(request.getContentLength()).toString()

instead of:

    Integer.toString(request.getContentLength())
Comment 1 Violeta Georgieva 2015-10-26 21:09:11 UTC
Hi,

Thanks for the report and the patch.
I applied the same fix on other places in the code also.
The fix is available in trunk, 8.0.x (for 8.0.29 onwards) and 7.0.x (for 7.0.66
onwards)

Regards,
Violeta
Comment 2 Christopher Schultz 2015-10-27 19:52:45 UTC
Should this usage of request.getContentLength be changed to use request.getHeader("Content-Length") to avoid the 2GiB primitive int limit?
Comment 3 Violeta Georgieva 2015-10-28 14:07:21 UTC
I switched to request.getContentLengthLong in trunk and Tomcat 8 trunk
Comment 4 Remy Maucherat 2015-10-28 14:20:49 UTC
Good move, the "efficiency" of the request dumper valve is meaningless, this issue is really nonsense. However, using the int version may not work properly, so that's a real fix.