arturobernalg commented on code in PR #567:
URL:
https://github.com/apache/httpcomponents-client/pull/567#discussion_r1720664106
##########
httpclient5/src/main/java/org/apache/hc/client5/http/entity/LazyDecompressingInputStream.java:
##########
@@ -83,19 +83,29 @@ public boolean markSupported() {
@Override
public int available() throws IOException {
- initWrapper();
- return wrapperStream.available();
+ return initWrapper().available();
}
@Override
public void close() throws IOException {
try {
- if (wrapperStream != null) {
- wrapperStream.close();
- }
+ Closer.close(wrapperStream);
} finally {
- wrappedStream.close();
+ super.close();
+ }
+ }
+
+ @Override
+ public synchronized void mark(final int readlimit) {
Review Comment:
Shouldn't we use ReentrantLock instead?
##########
httpclient5/src/main/java/org/apache/hc/client5/http/entity/LazyDecompressingInputStream.java:
##########
@@ -83,19 +83,29 @@ public boolean markSupported() {
@Override
public int available() throws IOException {
- initWrapper();
- return wrapperStream.available();
+ return initWrapper().available();
}
@Override
public void close() throws IOException {
try {
- if (wrapperStream != null) {
- wrapperStream.close();
- }
+ Closer.close(wrapperStream);
} finally {
- wrappedStream.close();
+ super.close();
+ }
+ }
+
+ @Override
+ public synchronized void mark(final int readlimit) {
+ try {
+ initWrapper().mark(readlimit);
+ } catch (final IOException e) {
+ throw new UncheckedIOException(e);
}
}
+ @Override
+ public synchronized void reset() throws IOException {
Review Comment:
same here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]