Bug 58540

Summary: Request setCharacterEncoding has unused code
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: This patch removes the unused buffer.

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).