Skip to content
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

Cleanup RestProxy code #43503

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
import java.io.InputStream;
import java.util.Objects;

import static io.clientcore.core.implementation.http.rest.RestProxyUtils.bodyTooLarge;
import static io.clientcore.core.implementation.http.rest.RestProxyUtils.bodyTooSmall;

/**
* An {@link InputStream} decorator that tracks the number of bytes read from an inner {@link InputStream} and throws
* an exception if the number of bytes read doesn't match what was expected.
*
* <p>
* This implementation assumes that reader is going to read until EOF.
*/
final class LengthValidatingInputStream extends InputStream {
Expand Down Expand Up @@ -112,9 +109,9 @@ private void validateLength(int readSize) {
if (readSize == -1) {
// If the inner InputStream has reached termination validate that the read bytes matches what was expected.
if (position > expectedReadSize) {
throw new IllegalStateException(bodyTooLarge(position, expectedReadSize));
throw new IllegalStateException(RestProxyImpl.bodyTooLarge(position, expectedReadSize));
} else if (position < expectedReadSize) {
throw new IllegalStateException(bodyTooSmall(position, expectedReadSize));
throw new IllegalStateException(RestProxyImpl.bodyTooSmall(position, expectedReadSize));
}
} else {
position += readSize;
Expand Down

This file was deleted.

Loading
Loading