Bug 58544 - RequestDumperFilter contentLength inefficiently creating Integer
Summary: RequestDumperFilter contentLength inefficiently creating Integer
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.0.x-trunk
Hardware: Macintosh Mac OS X 10.1
: P2 trivial (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-25 22:43 UTC by Anthony Whitford
Modified: 2015-10-28 14:20 UTC (History)
0 users



Attachments
Corrects contentLength logging to use less resources (657 bytes, patch)
2015-10-25 22:43 UTC, Anthony Whitford
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.