-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ResponseWriter.println(char) does not print newline #7031
Comments
This is quite the surprising issue. For many reasons ...
|
So ... The The implementation of I cannot see a bug there, as even the various small test of |
I'm talking about this one in @Override
public void println(char c)
{
try
{
synchronized (lock)
{
isOpen();
out.write(c);
}
}
catch (InterruptedIOException ex)
{
if (LOG.isDebugEnabled())
LOG.debug("Write interrupted", ex);
Thread.currentThread().interrupt();
}
catch (IOException ex)
{
setError(ex);
}
} It only calls I actually saw this behavior in a custom |
I'm in the process of improving code coverage for both |
+ Improving test coverage on response.getWriter() and response.getOutputStream() usage Signed-off-by: Joakim Erdfelt <[email protected]>
Opened PR #7032 |
Two bugs were found and fixed in PR #7032
|
+ Improving test coverage on response.getWriter() and response.getOutputStream() usage Signed-off-by: Joakim Erdfelt <[email protected]>
+ Improving test coverage on response.getWriter() and response.getOutputStream() usage Signed-off-by: Joakim Erdfelt <[email protected]>
+ Improving test coverage on response.getWriter() and response.getOutputStream() usage Signed-off-by: Joakim Erdfelt <[email protected]>
Some history, this bug was introduced in the Unchecked Print Writer commit 0dc3948 (introduced in Jetty 9.3.0) This has been fixed in all active branches. |
Jetty version(s)
10.0.7
Java version/vendor
(use: java -version)
openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9+11, mixed mode)
OS type/version
Windows 10, 64 bit
Description
When a single character is passed to
response.getWriter().println
, the newline after the character is not printed. In other words, for characters,print
andprintln
have the same effect.Other overloads for other parameter types do not seem to have this problem, just character.
How to reproduce?
Call a servlet that writes single characters using
response.getWriter().println(char)
and verify the output.The text was updated successfully, but these errors were encountered: