Bug 58540 - Request setCharacterEncoding has unused code
Request setCharacterEncoding has unused code
Status: RESOLVED FIXED
Product: Tomcat 8
Classification: Unclassified
Component: Catalina
8.0.x-trunk
Macintosh Mac OS X 10.1
: P2 trivial (vote)
: ----
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2015-10-25 22:15 UTC by Anthony Whitford
Modified: 2015-10-26 09:43 UTC (History)
0 users



Attachments
This patch removes the unused buffer. (540 bytes, patch)
2015-10-25 22:15 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:15:11 UTC
Created attachment 33212 [details]
This patch removes the unused buffer.

The 'buffer' variable is unused and can be removed.  (I suspect it is a remnant of some past code.) 


    @Override
    public void setCharacterEncoding(String enc)
        throws UnsupportedEncodingException {

        if (usingReader) {
            return;
        }

        // Ensure that the specified encoding is valid
        byte buffer[] = new byte[1];
        buffer[0] = (byte) 'a';

        // Confirm that the encoding name is valid
        B2CConverter.getCharset(enc);

        // Save the validated encoding
        coyoteRequest.setCharacterEncoding(enc);
    }
Comment 1 Violeta Georgieva 2015-10-26 08:14:12 UTC
Hi,

Thanks for the report and the patch.
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 Konstantin Kolinko 2015-10-26 09:43:05 UTC
(In reply to Anthony Whitford from comment #0)
> The 'buffer' variable is unused and can be removed.  (I suspect it is a
> remnant of some past code.) 

Thanks for noting.

As a historic reference: the code that used those variables was removed in r1140463 in a followup to r1138019 (bug 51400).