Repository navigation
Accept a page directive buffer size of 0kb - #1271
Open
arturobernalg wants to merge 1 commit into
Open
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
A buffer value of "0kb" was rejected as invalid, so a page using it failed with a translation error. The JSP specification only requires the size to be expressed in kilobytes, with a mandatory "kb" suffix, and output to be buffered with a buffer size not less than that specified. A size of 0kb is therefore valid, and it results in the page not being buffered, as it did before. Negative sizes and sizes that would overflow when converted to bytes are still rejected.
arturobernalg
force-pushed
the
jsp-buffer-zero-kb
branch
from
November 24, 2026 12:20
f94c24c to
dfa53c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
<%@ page buffer="0kb" %>is rejected with a translation error ("Page directive: invalid value for buffer"), so the page fails with a 500.The Jakarta Pages specification (page directive,
buffer="none|sizekb") says: "The size can only be specified in kilobytes. The suffix kb is mandatory or a translation error must occur. If a buffer size is specified then output is buffered with a buffer size not less than that specified." Thebufferelement ofjsp-property-grouptakes "those of the buffer page directive". A size of 0kb is therefore valid, and it means no buffering.This accepts 0kb again. Negative sizes and sizes that would overflow when converted to bytes are still rejected.
testBufferZeronow expects the page to work; it fails without the change.Tested on a Tomcat built from this branch:
0kbgives 200 with a buffer size of 0, asnonedoes;16kbgives 16384;-1kbstill fails translation.buffer="0kb" autoFlush="false"is still a translation error, as withnone. The Jasper tests pass.