Skip to content

MLE-27304 Small cleanup for Polaris#1913

Merged
rjrudin merged 1 commit intodevelopfrom
feature/polaris
Mar 2, 2026
Merged

MLE-27304 Small cleanup for Polaris#1913
rjrudin merged 1 commit intodevelopfrom
feature/polaris

Conversation

@rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Mar 2, 2026

No change here, just moving InputStreamTee into RequestLoggerImpl as that's the only place where it's used. And it makes it easier to see that the potential thread safety issues of InputStreamTee won't happen in practice.

Copilot AI review requested due to automatic review settings March 2, 2026 15:53
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

Copyright Validation Results
Total: 1 | Passed: 1 | Failed: 0 | Skipped: 0 | at: 2026-03-02 16:13:15 UTC | commit: fbe8e16

✅ Valid Files

  • marklogic-client-api/src/main/java/com/marklogic/client/impl/RequestLoggerImpl.java

✅ All files have valid copyright headers!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors request logging internals by moving InputStreamTee into RequestLoggerImpl, reflecting that it’s only used there and simplifying Polaris/thread-safety analysis.

Changes:

  • Inline InputStreamTee as a private static inner class in RequestLoggerImpl.
  • Remove the standalone InputStreamTee.java implementation file.
  • Consolidate java.io imports in RequestLoggerImpl.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
marklogic-client-api/src/main/java/com/marklogic/client/impl/RequestLoggerImpl.java Inlines InputStreamTee and updates imports.
marklogic-client-api/src/main/java/com/marklogic/client/impl/InputStreamTee.java Removes the now-inlined class file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


if (sent >= max) return in.read(b, off, len);

return readTee(b, 0, in.read(b, off, len));
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In read(byte[] b, int off, int len), the call to readTee passes an offset of 0 instead of the provided 'off'. This causes the tee stream to write the wrong slice of the buffer (and can log stale bytes that precede 'off'). Pass 'off' through to readTee so tee.write uses the correct data.

Suggested change
return readTee(b, 0, in.read(b, off, len));
return readTee(b, off, in.read(b, off, len));

Copilot uses AI. Check for mistakes.
Comment on lines +116 to +120
// Moved here in the 8.2 release to make it obvious it's only used by RequestLoggerImpl. It is only used by the
// copyContent method in RequestLoggerImpl. So while Polaris rightfully complains about the thread safety issues of
// this class, it is only used in a single thread context and so the thread safety issues are not a problem.
private static class InputStreamTee extends InputStream {
private InputStream in;
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newly added inner class uses tab indentation, while the rest of RequestLoggerImpl uses spaces. This makes the file inconsistent and can cause style/lint failures; please re-indent this block to match the existing spacing in the file.

Copilot uses AI. Check for mistakes.
BillFarber
BillFarber previously approved these changes Mar 2, 2026
No change here, just moving InputStreamTee into RequestLoggerImpl as that's the only place where it's used. And it makes it easier to see that the potential thread safety issues of InputStreamTee won't happen in practice.
@rjrudin rjrudin merged commit b529df1 into develop Mar 2, 2026
5 checks passed
@rjrudin rjrudin deleted the feature/polaris branch March 2, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants