-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BEAM-14539] Ensure that the print stream can handle larger byte arrays being written and also allow for a growable amount of carry over. #17787
Conversation
…ys being written and also allow for a growable amount of carry over.
R: @scwhittle Note that we never looped during decoding which lead to us copying the remainder of bytes over. |
@@ -65,8 +65,7 @@ private static class JulHandlerPrintStream extends PrintStream { | |||
private final Level messageLevel; | |||
private final CharsetDecoder decoder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be good to add annotations that these are guarded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -130,46 +128,50 @@ public synchronized void write(int i) { | |||
@Override | |||
public void write(byte[] a, int offset, int length) { | |||
ByteBuffer incoming = ByteBuffer.wrap(a, offset, length); | |||
assert incoming.hasArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could return early for length == 0, not obvious if this would hold in that case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it still does hold, added code to return early for length == 0
for (LogRecord logRecord : handler.getLogs()) { | ||
actualMessages.append(logRecord.getMessage()); | ||
} | ||
assertThat(actualMessages.toString(), containsString(msg + newlineMsg)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could this be equals instead of containsString?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, had to expose output warning since that is the prefix.
Otherwise LGTM |
Run Java PreCommit |
1 similar comment
Run Java PreCommit |
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.