File tree Expand file tree Collapse file tree 1 file changed +4
-16
lines changed
src/main/java/org/cactoos/http/io Expand file tree Collapse file tree 1 file changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,6 @@ public final class AutoClosedInputStream extends InputStream {
38
38
*/
39
39
private final InputStream origin ;
40
40
41
- /**
42
- * If the stream has been closed.
43
- */
44
- private boolean closed ;
45
-
46
41
/**
47
42
* Cotr.
48
43
*
@@ -55,10 +50,7 @@ public AutoClosedInputStream(final InputStream origin) {
55
50
56
51
@ Override
57
52
public void close () throws IOException {
58
- if (!this .closed ) {
59
- this .origin .close ();
60
- this .closed = true ;
61
- }
53
+ this .origin .close ();
62
54
}
63
55
64
56
@ Override
@@ -115,13 +107,9 @@ private final class AutoClosed implements IntScalar {
115
107
@ Override
116
108
public int value () throws IOException {
117
109
final int ret ;
118
- if (AutoClosedInputStream .this .closed ) {
119
- ret = -1 ;
120
- } else {
121
- ret = this .origin .value ();
122
- if (ret < 0 ) {
123
- AutoClosedInputStream .this .close ();
124
- }
110
+ ret = this .origin .value ();
111
+ if (ret < 0 ) {
112
+ AutoClosedInputStream .this .close ();
125
113
}
126
114
return ret ;
127
115
}
You can’t perform that action at this time.
0 commit comments